dimanche 8 juillet 2018

Authorize a form request only if it an ajax call

I have a form that i want to authorize only if the call was made by ajax, so i tried

....
//MyRequest authorize function
public function authorize()
{
    return $this->ajax();
}

But after when i do the ajax call, in the console it shown "This action is unauthorized.", so how can i detect if the call was an ajax and return true, else return false?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire