2 months ago

Axios ajax call not working working on chrome but working safari

Posted 2 months ago by nhayder

i'm struggling with this issue since a couple of hours now, on my app i'm requesting data from DB using axios ajax function.

this is the js function on my store.js store file

        async saveText({commit}, [id, text, name, wIndex]){

            await axios.put('/admin/designer/api/widget/text', {

                elem: text,

                elemName : name,

                elemId: id,


            .then(function (response) {

                commit('UPDATE_W_ELEM', [name, wIndex, response.data]);


            .catch(function (error) {




this is the route

Route::put('/widget/text', '[email protected]');

this is what i have on the controller

    public function updatewidgettext(Request $request)


            'elem' => 'required|string',

            'elemName' => 'required|string',

            'elemId' => 'required|integer'


        $name = $request['elemName'];

        $elemId = $request['elemId'];

        $elemText = trim($request['elem']);

        $updateWidget = Widget::findOrFail($elemId);
        $updateWidget->$name = Purifier::clean($request['elem'], 'designer');

        Cache::forget('page-'.$updateWidget->page_id); // front page cached file

        return $updateWidget->$name;

the function is working perfectly on chrome and firefox but not on safari, I'm not sure why by i getting this error

    "message": "The given data was invalid.",
    "errors": {
        "elem": [
            " field elem required."
        "elemName": [
            " field elem name required."
        "elemId": [
            " field elem id required."

it looks like axios is not being able to pass the data on safari properly, ????

is there is anything i can do to solve this issue????

Any idea ????

Please sign in or create an account to participate in this conversation.