I use this script to insert a comment on 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+'&nocache = '+nocache);
http.onreadystatechange = insertReply;
http.send(null);
}
function insertReply() {
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('insert_response').innerHTML = ''+response;
}
}
Now it innerHTML prints the response text that comes from the insert.php file.
But inside insert.php I set some "restrictions" in PHP, for example, if they are empty, if double mail, etc. etc. Therefore, I cannot place this in: window.parent.showMessage ("Video is OK"); after if (http.readystate == 4) ..
So, I would like to make another function for this script that checks / searches for a div named #box and contains "1", and then it should: window.parent.showMessage ("Video is OK");
I use jquery too
Karem source
share