简体   繁体   中英

Error while inserting data into database using with ajax,php

Error while inserting data into database using with ajax,php and jquery, works for a localhost but after upload into server it gives error.

$('#sunsubmit').click(function(){
    var insertedvalue = $('#sundayform').serialize();
    $('form#sundayform').unbind('sunsubmit');
    $.ajax({
        type: "POST",
        url: "routineinsert/sunday.php",
        data: insertedvalue,
        beforeSend: function(messageinfo){},
        success: function(messageinfo){ 
            var c = customalertbox.render("Message!!",messageinfo);
            progressdiv.style.display="none";},
        error: function(jqxhr) {
            customalertbox.render(jqxhr.responseText);
        }
});

it works fine for with in my computer where but however but for a server it even not redirected to the sunday file where insert code is located it direct calls the error function.

Your success function seems to be missing the opening brace:

success: function(messageinfo) 

It should be

success: function(messageinfo) {

This is easier to notice if you are always careful about format:

    success: function(messageinfo)  <============
        var c = customalertbox.render("Message!!",messageinfo);
        progressdiv.style.display="none";
    },
    error: function(jqxhr) {
        customalertbox.render(jqxhr.responseText);
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM