"something went wrong parsererror" Ajax jquery Php

Posted 7 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.

Reply to

Use Markdown with GitHub-flavored code blocks.