-ldjia
Last Updated: June 11, 2017
·
1.459K
· jasonyost

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.');
  }
});

2 Responses
Add your response

14862

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

great one thank you !

over 1 year ago ·