jeudi 26 mai 2016

Return value not string in php

I have a mail function in php that echoes a response. The browser's developer tool is showing the response as string, but when I capture that response in the front end, with a callback function, it is showing as a json object. So what is printed in the screen is

{"0":"A","1":" ","2":"t","3":"e","4":"m","5":"p","6":"o","7":"r","8":"a","9":"r","10":"y","11":" ","12":"p","13":"a","14":"s","15":"s","16":"w","17":"o","18":"r","19":"d","20":" ","21":"h","22":"a","23":"s","24":" ","25":"b","26":"e","27":"e","28":"n","29":" ","30":"s","31":"e","32":"n","33":"t","34":" ","35":"t","36":"o","37":" ","38":"y","39":"o","40":"u","41":"r","42":" ","43":"e","44":"m","45":"a","46":"i","47":"l"}

I have no idea why? I am using Laravel 5.1 and angularJS for the front end.

This is the code for the function

 if (Mail::send('test-view', ['pass' => $pass], function($message) use ($data)
    {
    $message->to('esolorzano@renovatiocloud.com', 'Tarzan de la Selva')->subject('Password Reset');
    })){
       echo "A temporary password has been sent to your email"; 
    }else {
        echo "There was an error sending the temporary password";
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire