jquery Pass the Chinese parameter garbled, because the default delivery method is not adopted UTF-8, all we can pass the parameters of the parameters of the code, and then operation, code as follows, the red code for the passed parameters, has been labeled
Copy Code code as follows:
Smsubmitclick = function () {
$ (document). Ready (function () {
var name = $ ("#txt_name"). Val ();
var type = $ ("#seltype option:selected"). Val ();
var zjnum = $ ("#txt_num"). Val ();
if (name = = NULL | | name = = "")
{
Alert ("Please enter your real name");
return false;
}
if (Name.length > 20)
{
Alert ("Sorry, your username is abnormal, please re-enter");
$ ("#txt_name"). focus ();
$ ("#txt_name"). Val ("");
return false;
}
if (Zjnum = null | | zjnum = = "")
{
Alert ("Please enter the identification number");
return false;
}
if (Zjnum.length > 30)
{
Alert ("Sorry, your document is abnormal, please re-enter");
$ ("#txt_num"). focus ();
$ ("#txt_num"). Val ("");
return false;
}
Else
{
$.ajax ({
Type: "Get",
Cache:false,
ContentType: "Application/x-www-form-urlencoded:charset=utf-8",
URL: "Ajaxpage.aspx?t=smrz&name=" +escape (name) + "&zjtype=" +escape (type) + "&zjnum=" +escape (zjnum) + "",
DataType: "JSON",
Success:function (data) {
alert (data.info);
}
})
}
})
}