JavaScript Code
The code is as follows:
function Existproduct (obj) {
var ProductName = Escape (Obj.val ());
$.getjson (".. /product/searchproductbyname.action ", datat,function (data) {
var falg;
Falg = data[0][' existproduct '];
Falg return to no or yes,
return falg;
});
}
function Validateform () {
Alert (existproduct ("#products_name"));
if (Validatenotnull ("#products_name")) {
if (Existproduct ("#products_name")) {
$ ("#productform"). Submit ();
}else{
$ ("#spanproduct"). HTML ("Business name already exists");
}
}else{
$ ("#spanproduct"). HTML ("Business name cannot be empty");
}
}
In this existproduct (obj) function, I call the Getjson function in jquery to return the results of the lookup in the database, which should have no problem with the Firebug, which is outrageous in the execution of the code to execute the returns FALG, And then execute Getjson, please the Master of the guidance