"something went wrong parsererror" Ajax jquery Php

Posted 4 months ago by filipe1221

Hi, iam using a form widht ajax and was working but now gives error "something went wrong parsererror SyntaxError: Unexpected end of JSON input" but return 200 var form_data = $('.form').serialize() ;

    event.preventDefault(e);

    $.ajax({

        type: 'POST',

        url: 'ajax_form?type='+type,

        data:form_data,

        dataType: 'json',

        success: function(response){

            console.log(response);

        },

        error: function( req, status, err ) {

            console.log( 'something went wrong', status, err );

        }

    })

if i print my return in php returns a array ['class']='success' ['code']="ok"

i try delete dataType: 'json', and use json encode in return but nothing

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

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.