Community
cancel
Showing results for 
Search instead for 
Did you mean: 
xkevin
New Contributor I
68 Views

Ajax request error

I got this error on debug mode:


And the Error on alert is: "parsererror SynthaxError: Unexpected end of input".
I search for the error on google but it doesnt fixed my problem.

This my code:

        $.ajax({
                       type: "POST",
                        url: "http://www.example.com/login_user.php",
                        crossDomain: true,
                        dataType: 'json',
                        data: $.trim(frm.serialize()),
                        beforeSend: function() {
                            $('#loader').css({
                                display: "block"
                            });
                        },
                        success: function(data, status, XHR) {
                            console.log("result is " + data);
                            handleData(data);
                        },
                        error: function(httpReq, status, exception) {
                            alert( status + " " + exception);
                            $('#loader').css({
                                display: "none"
                            });
                       }
});

function handleData(responseData) {
                var access = responseData;

                if (access == "real") {
                    alert("Welcome");
                    location.href = "home.html";
                    $('#loader').css({
                        display: "none"
                    });


                } else {
                    alert("Your username and password didn\'t match.");
                    $('#input_password').val('');
                    $('#loader').css({
                        display: "none"
                    });
                }
                console.log(responseData);
            }

The server will only send or respond "real" for good access or "not real" for bad access detail.

Tags (2)
0 Kudos
2 Replies
PaulF_IntelCorp
Employee
68 Views

xkevin
New Contributor I
68 Views

Hi Paul F. Thank you for giving some source. I have tried all the possible way indicated there. But it seems that it is different on my part! It's weird. I tried to upgrade/downgrade the Cordova version, linked the jquery v2, but same error. I tried to build my app then install on my andriod phone and to my surprise it work smoothly. I think and therefore conclude that the "Debug" tab was not working well, and I am continue developing my app using the emulate tab. Not using the debug tab because it kills my time. :D

Reply