jQueryTutorial

Use with input all form elements password radio

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: </head><body> <div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div> <button>Get External Content</button> </body></html> Copyright Ellis Horowitz 2013 23 AJAX Example 2 <!DOCTYPE html><html><head> <script src="http:// ajax.googleapis.com/ajax/libs/jquery/ 1.10.2/jquery.min.js"> </script><script> $(document).ready(function(){ $("button").click(function(){ $ ("#div1").load("demo_test.txt",function (responseTxt,statusTxt,xhr){ if(statusTxt=="success") alert("External content loaded successfully!"); if(statusTxt=="error") alert("Error: "+xhr.status+": "+xhr.statusText); }); }); }); </script></head><body> <div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div> <button>Get External Content</button></ body></html> Copyright Ellis Horowitz 2013 24 AJAX Example 3 – GET Method <!DOCTYPE html><html><head> <script src="http:// ajax.googleapis.com/ajax/libs/ jquery/1.10.2/jquery.min.js"> </script><script> $(document).ready(function(){ $("button").click(function(){ $.get("demo_test.asp",function(data, status){ alert("Data: " + data + "\nStatus: " + status); }); }); }); </script></head><body> <button>Send an HTTP GET request to a page and get the result back</ button> </body></html> The $.get() method requests data from the server with an HTTP GET request. The required URL parameter specifies the URL you wish to request. The optional callback parameter is the name of a function to be executed if the request succeeds. The following example uses...
View Full Document

Ask a homework question - tutors are online