Home > front end >  Page and database, a great god for help
Page and database, a great god for help

Time:10-09

Click on the validation data in the garage and the content of the text field below the values in the parentheses to compare if the same display statement is correct, otherwise the error, how to compare




The function yanzhengClick () {
Var arrs=[];
Var zdmjText=$(" # zdmjText "). Val ();
STR=zdmjText;
Var arrs2=STR. The substring (STR) indexOf (" (") + 1, STR., indexOf (") "));//get the values in the parentheses from page
//1, the value that was obtained from the page (arrs) and the index value of the library, if there is a display correctly, or false
$. Ajax ({
Type: 'get',
Url: '/onemap selectTargetmanagementsNameAndBase. Do,
ContentType: "application/json,"
DataType: "json",
Success: the function (data) {

For (I in data) {//"+ data [I] targetvalueBase +" in brackets behind the value of the
Shuju=data [I] targetName;//database to get the value of the
var count=0;

For (var j=0; J & lt; Shuju. Length; J++) {
Var STRB=shuju [j];
}
If (arrs2==STRB) {//on the opposite side of the values of the page and database
count++;
}
If (count==0) {//if equal to 0 means no value in the database
//alert (" error ")
} else {
//alert (" right ")
}



}
}
})
  • Related