Javascript in WordPress
-
I’m running this javascript in WordPress. It can’t find the page in this line of code. The page it is trying to open is in the same folder that the plugin’s main page that loads the javascript is located but the WordPress system is preventing the following line from finding or opening the file (gets a 404). I’m stumped. xmlhttp.open(“GET”,”getsubcat1.php?q=”+myarr[1],true);
So it can’t find “getsubcat1.php” which is in the same directory as the plugin main page.
Any ideas?
—————————————-
The line “window.alert(“showsubcat1 func status is NOT 200 , 1st this.readyState, then this.status” + this.readyState + ” ” + this.status );” is being tripped showing a 404 because the “if” statement ahead of it ( if (this.readyState==4 && this.status==200) {) fails when it tries to open -> xmlhttp.open(“GET”,”../getsubcat1.php?q=”+myarr[1],true);function showSubCat1(str, wp_plugin_path) {
var myarr = str.split(“:”);sessionStorage.setItem(‘catid’, myarr[1]);
if (str==””) {
document.getElementById(“txtHint1″).innerHTML=””;
return;
}
window.alert(“showsubcat1 func window.location.pathname ” + window.location.pathname );if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”);
}
xmlhttp.onreadystatechange=function() {
if (this.readyState==4 && this.status==200) {
window.alert(“showsubcat1 func status is 200 ” + window.location.pathname );
document.getElementById(“txtHint1”).innerHTML=this.responseText;
document.getElementById(“txtHint2”).innerHTML=still_more_cats;}
else
{
window.alert(“showsubcat1 func status is NOT 200 , 1st this.readyState, then this.status” + this.readyState + ” ” + this.status );
window.alert(“showsubcat1 func wp_plugin_path ” + “/plugins/wordpress_plugin-master/getsubcat1.php?q=”+myarr[1] );}
}
document.getElementById(“category_id”).value = myarr[1];
document.getElementById(“category_name”).value = myarr[2];
xmlhttp.open(“GET”,”../getsubcat1.php?q=”+myarr[1],true);
xmlhttp.send();
}The page I need help with: [log in to see the link]
- The topic ‘Javascript in WordPress’ is closed to new replies.