Home >Web Front-end >JS Tutorial >Code to implement asynchronous refresh based on JQuery (reprint)_jquery

Code to implement asynchronous refresh based on JQuery (reprint)_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 18:08:501167browse

Today we will briefly introduce the calling of this package
The example is as follows:
Calling page: JqueryTest.aspx (note: no code in the background)

Copy code The code is as follows:





title> <br><script src="JS/jquery-1.4.2.js" type="text/javascript"></script> <br><script language="javascript"> <BR>function test() { <BR>$.ajax({ <BR>type: "POST", <BR>url: "JqueryService.aspx", <BR>data: "userName=123&password=456" , <BR> success: function(data) { <BR>if (data == "true") { <BR>alert("Login successful!"); <BR>} <BR>else { <BR>alert("Login failed" ); <BR>} <BR>} <BR>}); <BR>} <BR>function btntestajax_onclick() { <BR>test(); <BR>} <BR></script> <br> <br>







Called interface: JqueryService
Front desk:

Backend:
Copy code The code is as follows:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace XmlHttpRequestTest
{
public partial class JqueryService : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String userName =Request.Form["userName"].ToString();
String password=Request.Form["password"].ToString();
if (userName.Equals("123") && password.Equals ("456"))
{
Response.Write("true");
}
else
{
Response.Write("false");
}
}
}
}

Note: Because the code is too simple, no detailed explanation is given. If you don’t understand something, please refer to the relevant information yourself.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn