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+'&nocache = '+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