0

I am using the following jquery function in my asp file

$(function() {

    $("#frm-submit").submit(function() {
        var data = $(this).serialize(),
          action = $(this).attr("action"),
          method = $(this).attr("method");
                                                                      //Hide Login Button
        //$('#loginprogress').html('<img src="images/loading_bar.gif">'); // Show Progress Spinner

        //$(".loading").show(); // show loading div
        $.ajax({
            url: action,
            type: method,
            data: data,
            success: function(data) {

            $("#stage").text(data);
            document.location = "***awp.asp***";                                        // Hide Progress Spinner

            },
            error: function(err) {
                // there was something not right...
            },
            complete: function() {
                $(".loading").hide(); // hide the loading
            }
        });

        return false; // don't let the form be submitted
    });

}

);

my awp.asp file is

 objdb.execute("insert into awp values('"& awpid &"','"& varcid &"','"& varsid &"','"& varmcid  &"','"& varsubacid &"','"& varselaid &"','"& varselsubaid &"','"& vardivid &"','-','"& varunits &"','"& varucost &"','"& varptarget &"','"& varftarget &"','"& varbbenefper &"','"& varida &"','"& vargovtcot &"','"& varbcont &"','"& now() &"','"& loginid &"','"& varawp &"','"& seldish("catid")&"','"& seldish("minorheadcode")&"')")

where I have to return the success or error message

presently I am storing it as a session vairable session("message")= " Records Successfully Inserted"

How to display the success message?

aelor
  • 10,892
  • 3
  • 32
  • 48
  • Actually, I don't think that's what he is asking. Looks to me like he wants to know how to return a response from ASP, as he's already got the success callback in place. – Reinstate Monica Cellio Apr 29 '14 at 11:37

1 Answers1

0

In your ASP you need to handle the success/failure of your execute call and then simply respond with something relevant...

Response.Write("Database updated");
Response.End();

That's what will be passed as data to the success callback in your ajax call...

success: function(data) {
    alert(data);  // this will show the ASP response
    // do whatever you need when successful
},
Reinstate Monica Cellio
  • 25,975
  • 6
  • 51
  • 67