認爲我有一個JSON數組這樣檢查JSON數組與我的價值,做了手術,否則其他操作
["map14","map20","map21","map22","map23","map24","map25","map31","map32","map33","map34","map35","map36","map37","map40","map41","map42","map46","map49","map50"]
這個JSON數組我需要檢查,如果我傳遞的值存在需要做一些操作或以其他方式一些其它操作....
JavaScript代碼:
function pop(e,id) {
$.getJSON('layoutcheck.php', { some_get_var: 1 }, function(output){
var i=0, total = output.length;
for (i = 0; i < total; ++i) {
if(isArray(output[i]==id)) {
// do soome stuff if the value exists in the database
}
else{
// if not exists some other operation
}
}
});
}
</script>
layoutcheck.php將獲取從數據庫中的信息,並創建一個JSON數組..
但代碼未能顯示輸出..請糾正我..
感謝
那麼問題是什麼?更新:好吧,你剛剛更新你的問題。 – Rishabh 2013-04-18 04:14:30
但上面的代碼無法顯示...如果修改一些東西..它將執行任何一個操作,即如果或其他 – user2212724 2013-04-18 04:16:04
你'console.log(輸出);'檢查它包含什麼? – Rishabh 2013-04-18 04:17:16