[RESOLVED]How to detect if form submitted in document.ready function using jquery?


I want to use the condition if form submitted in document.ready function.

I tried to add a boolean property in the view’s model and set it to true in the httppost action before I return View(model).

The boolean property of-course is hidden field in the view. However the "return View(model)" call the model constructor that initialize the 

boolean property to false, so I couldn’t use it in document.ready function.

What is the way to detect form submission in document.ready function?



The issue you have is likely
 It would likely work if you change the hidden field client side using the "onsubmit" event (or as shown above, remove the posted value from the model state so that the
new model value can be taken into account or clear the model if you just reload all values).

Not directly related but it can be a good idea to always give a short description of the final goal. It can help to raise other suggestions or more accurate answers or warn about unanticipated issues with the current approach compared with just knowing about
the immediate technical need.

Leave a Reply