mercredi 4 mai 2016

laravel 5 ajax getting data to view as php value

I'm having trouble understanding the ajax in laravel 5:

How to pass data from javascript to view as php variable.

Controller.php (ajax function):

public function getID()
    {
        $studid = Request::get('studid');
        $a = array(
            'studid' => $studid,
        );
        header("Content-type: text/x-json");
        echo json_encode($a);
        exit();
    }

view.blade.php:



(how to write it properly to get $studid data to php so i can compare it in if statement?)

Thanks.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1WJOGFR
via IFTTT

Aucun commentaire:

Enregistrer un commentaire