开发者

Look for div# in the response, if data is 1

I am using this script to insert comment to the database:

var http = createObject();
var nocache = 0;
function insert() {
document.getElementById('insert_response').innerHTML = "To Sek .. "
var fID= encodeURI(document.getElementById('fID').value);
var kommentar= encodeURI(document.getElementById('kommentar').value);
nocache = Math.random();
http.open('get', 'insert.php?fID='+fID+'&kommentar=' +kommentar+'&noca开发者_C百科che = '+nocache);
http.onreadystatechange = insertReply;
http.send(null);
}
 function insertReply() {
 if(http.readyState == 4){
 var response = http.responseText;
 document.getElementById('insert_response').innerHTML = ''+response;
 }
} 

Right now it innerHTML out the response text, that comes from insert.php.

But inside insert.php, i have setted up some "restrictions" in PHP like if empty, if double post etc. etc. I can therefore not place in: window.parent.showMessage("Video Is OK"); after if(http.readystate == 4)..

So i would like to do another function to this script, that checks/looks for a div called #box and is containing "1", then it should: window.parent.showMessage("Video Is OK");

I use jquery too


if ($("#box[value=1]").length > 0) { alert("Video is OK"); }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜