-ldjia
Last Updated: June 11, 2017
·
1.204K
· jasonyost
2182167268 72

POST ASP.NET form with jQuery excluding the ViewState

// POST all the datas! except the ViewState
jQuery.post('https://www.example.com', jQuery("#form :not(#__VIEWSTATE) > :input").serialize() ,function(data,status){
  if(data[0]["Status"] == "Success"){
    jQuery("#poststatus").html("Thank you!");
    //alert('Thank you for registering!');
  }else{
    jQuery("#poststatus").html("There has been an error while accepting your submission. Please contact us.");
    //alert('There was an error while accepting your submission. Please contact us.');
  }
});
Say Thanks
Respond

2 Responses
Add your response

14862
2182167268 72

This grabs the form tag created by ASP.NET and serializes all fields except for the ViewState, it then POSTs that data to the URL of your choosing.

Make sure to change the data array to grab the appropriate value for a successful submission.

over 1 year ago ·
29020
Mary

great one thank you !

6 months ago ·