Gossip is less to say. Look at the scene of the accident first.
The scene of the accident
Now I want to do is through JS to call the background controller method, you can see the client is jquery and Ajax, now the problem is JS can run to, but the background code is not run to the Controller method.
My solution
Ajax code is wrong, you can see the code I did not set the request method, that is, synchronous request or asynchronous request, AJAX default asynchronous request, that is, here I want to use AJAX to implement synchronization requests.
So say one more request in Ajax.
Write Ajax with jquery
The following is a way to use Ajax.
$.ajax ({
method//Data submission: Get and post
URL//Data submission Path strength Async//
support asynchronous Refresh, default is True
data
//required Submission DataType//server returns the type of data, such as Xml,string,json, etc
success//callback function after a successful callback function
error//request failed
;
When it comes to AAJX, we might think of it as an asynchronous call that improves the user experience, but this time Ajax uses a synchronized approach, and hopefully this article will help you learn.