JQuery is indeed a very lightweight JS framework that can help us quickly develop JS applications and change the habit of writing JavaScript code to a certain extent.Let's talk nonsense and go straight to the question. Let's take a look at some simple methods, all of which are for jQuery. ajax () is encapsulated to facilitate our use of the method. Of course, if
AJAX Based on JQuery framework
I posted a post a few days ago, sharing the prototype framework about AJAXLearningProcess. Some people say that the jquery framework is more convenient.Just because thickbox is ready for use in the project, we simply discard prototype. js and look at jquery. js.
the return data to HTML text Format 5 response.setcontenttype ("Text/html;charset=utf-8"); 6 Response.setheader ("Pragma", "no-cache"); 7 Response.setheader ("Cache-control", "No-cache"); 8 PrintWriter out =null; 9 try {Ten String Chinese = request.getparameter ("Chinese"); 11//Parameter value is in Chinese and needs to be converted 12 Chinese = new String (chinese.getbytes ("iso-8859-1"), "Utf-8"); System.out.println ("Chinese is:" +chinese); 14 15//Business Processing page resultd
This plug-in was introduced in the previous JQuery template plug-in-jquery. tmpl. Sometimes we need to use dynamic ajax to load templates or data, and load different templates and Data Based on url parameters or other information. I have this requirement in a certain project, so I specially wrote jquery tool functions
Jquery Ajax method passes value to actiondata是json数据。传递到的Action是 /home/myajax. The way to receive it at the action method is as follows:Public ActionResult Myajax (string val1) { string val2 = request["Val2"]. ToString (); String val3 = request.form["Val3"]. ToString (); String val4 = request.params["Val4"]. ToString (); Return Content ("ViewUserControl1");
after the project is large and small there are many, the impression that many of the framework of low-level encapsulation method is based on the Ajax () method to expand. The AJAX approach can be said to be the originator of various AJAX-related methods provided by jquery, and all other methods, such as Load,get,post,g
Reprint: http://blog.csdn.net/lovecruel/article/details/6697764Here is a simple explanation of the AJAX calls to jquery WebService several parameters,Type: requested, post must be used here. The WebMethod method accepts only post-type requestsContentType: The content encoding type when sending information to the server. We must use Application/json here.URL: The path to the server-side handler for the reque
function. If the value is successful, a success message is returned to the user:
The Code is as follows:
$. Ajax ({Type: "POST ",Url: "bin/process. php ",Data: dataString,Success: function (){Certificate ('{contact_form'}.html ("
");
Certificate ('{message'{.html ("Contact Form Submitted! ")
. Append ("
We will be in touch soon.")
. Hide ()
. FadeIn (1500, function (){
$ ('# Message'). append ("");
});
}
});
Return false;
In this example,
", // accepts the returned data type, has Text/json/xml success:function(data) { // successful, the returned data, with this callback function to accept, data is its own definition of the name, the received data will be stored in data alert (data); } })Example 1:ajax Asynchronous Authentication Login1. Login interface2. Processing the pagePHP $uid $_post ["U"]; include ("DBDA.class.php");
using the Jsonp form, such as Myurl? Callback=? , jquery will automatically Replace the last one "? "For the correct function name, the callback function has been executed. text: Returns the stored text string. NBSP;
beforesend
function
function (XMLHttpRequest) { this;//The options parameter passed when calling this Ajax request }
Preface
1. Load Request2. Error handling3. Request Global Events
In the Ajax lesson, we learned about the most basic asynchronous processing methods. In this chapter, we'll look at some of the global request events, cross-domain processing, and other issues with Ajax. one. Load Request
When Ajax asynchronously sends a request, it encounters a slow speed, and the
I use AJAX to delete data, delete successful return 1,JS The return value of 1, I will reload the current Div, to implement the page without flushing delete data,
success:function(data){ if (data.tag == 0){ alert('删除失败'); } else { $('#detail').xxx(yyy); }}
$('#detail').xxx(yyy);How to write this code can be directly overloaded with ID detail div, I do not want to send again in PHP data come over, want to directly reload, can ac
Jquery. Ajax (options)
Parameters:
Options
Return Value:
XMLHttpRequest
Use http to request a page.
This is jquery's low-level Ajax implementation. For more information about advanced abstraction, see $. Set and $. Post. These methods are easier to understand and use. However, there are functional limitations (for example, there are no error handler functio
requests
Parameters:
URL (String): The URL address of the sending request.
Data (MAP): (optional) data to be sent to the server, expressed as a Key/value key-value pair.
Callback (function): (optional) The callback function when loading succeeds (the method is called only if the return state of response is success).
type (String): (optional) The official description is: Type of data to be sent. The type that should actually be requested for the client (Json,xml, etc.)
Because response is used in the background. Write (); This method, when the output is finished, no end will continue to output, so need to use the response. End (); So the problem is solved.jquery Ajax, in addition to the value via the URL, backstage with respon.querystring["" "to obtainYou can also use data to transmit values in the background with respon. Form[""] to getThe Ajax method of
Use Asp.net MVC, jquery, and jquery UI to build Ajax-based Ria applications.Asp.net MVC, a beginner the day before yesterday, found that some things are more convenient to do with web form. however, Asp.net MVC also has its advantages. it would be too convenient to combine jquery and
Jquery is indeed a very lightweight JS framework that can help us quickly develop JS applications and change JavaScript writing to a certain extent.
Code .
Let's talk nonsense and go straight to the question. Let's take a look at some simple methods, all of which are for jquery. ajax () is encapsulated to facilitate our use of the method. Of course, if you want
This article mainly introduces the load () and post () Methods of ajax in jQuery, and analyzes the load () and post () methods in jQuery in detail using examples () methods To achieve ajax interaction related skills and precautions, you can refer to the example of this article describes the
JQuery-1.9.1 source code analysis series (16) ajax -- jsonp principle, jquery-1.9.1jsonp
Json jsonpType
"Json": The response result is executed as JSON and a JavaScript Object is returned. If you specifyjsonThe response result is used as an object before being passed to a successful processing function.JQuery. parseJSON. The parsed JSON object can bejqXHRObjectre
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.