February 2010
Beginner
400 pages
11h 13m
English
It is very common for performance optimization to need to retrieve data or code from an external source after a page is loaded. jQuery makes this very easy.
The following code loads an external JavaScript file called test.js and then executes it:
$.ajax({
type: "GET",
url: "test.js",
dataType: "script"
});
The test.js file consists of just the following line:
alert('hello');
You often need to submit data to another web page. You can easily do this with the following code:
$.ajax({
type: "POST",
url: "myForm.aspx",
data: "firstname=Alex&lastname=Mackey",
success:
function() {
alert("form submitted");
}
});
You will use this functionality in the ASP.NET MVC example ...