Want to return data from ajax success when ajax is calling with in a function

 function ajax($url,$data,$type)
    {

        $.ajax({
            type: $type,
            url: $url,
            data: $data,//{'itemid':$itemId},
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            },
            success: function($data){
                return $data;
            },
            error: errorReturn
        });

    }

i am trying this one $data = ajax(url,data,type);



Read more here: https://stackoverflow.com/questions/66994835/want-to-return-data-from-ajax-success-when-ajax-is-calling-with-in-a-function

Content Attribution

This content was originally published by Bilal Waheed at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: