Thanks for your reply. Really appreciate it.
What I'm trying to do, and it works in a regular href, is to load an external php file onto a <div id="MenuContentArea"></div>
The ajax code below. Could be a jQuery jump menu the solution to call the javascript:ajax function?
Code:
var runOnce = 0;
function ajaxBasic(URL,func) {
$.ajax({
url: URL,
cache: false,
beforeSend: function( ) {
$("#"+func).html('<img src="/images/loading.gif" border="0" />');
},
success: function(html){
$("#"+func).html(html);
}
});
}
function ajax(URL,func, frm) {
// begin fix
if(URL.indexOf('?')==-1){
URL= URL+'?rand='+ randomNum();
}else{
URL= URL+'&rand='+ randomNum();
}
// end fix
var xmlHttp; try {
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
} catch (e) {
// Internet Explorer
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
alert("Your browser does not support AJAX!");
return false;
}
}
} xmlHttp.onreadystatechange=function() {
if(xmlHttp.readyState<4) {
ObId = document.getElementById(func)
if(ObId){
ObId.innerHTML = '<img src="/images/loading.gif" border="0" />';
}else{
RunFunc = func + "('<img src=\"/images/loading.gif\" border=\"0\" />')";
eval(RunFunc);
}
}
if(xmlHttp.readyState==4) {
ObId = document.getElementById(func)
if(ObId){
ObId.innerHTML = (xmlHttp.responseText);
PanelMenu();
}else{
RunFunc = func + "('" + escape(xmlHttp.responseText) + "')";
eval(RunFunc);
PanelMenu();
}
}
}
paramstring = ""
if(frm){
alert(frm.elements.length);
for (var i=0 ; i<frm.elements.length ; i++ ) {
paramstring += frm.elements[i].name +"="+ escape(encodeURI(frm.elements[i].value)) + "&"
}
}
method = frm ? "POST" : "GET" ;
xmlHttp.open(method, URL, true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
xmlHttp.setRequestHeader("Content-length", paramstring.length);
xmlHttp.send(paramstring);
}
function loadContent(url) {
ajax(url,"contentArea")
}
function loadContentLeft(url) {
ajax(url,"contentAreaLeft")
}
function randomNum( min, max ) {
var argc = arguments.length;
if (argc === 0) {
min = 0;
max = 2147483647;
} else if (argc === 1) {
throw new Error('Warning: rand() expects exactly 2 parameters, 1 given');
}
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function PanelMenu(){
//if(runOnce!=0)return;
if ($(".accordion2 .Myheader").length){// check to see if this classes exist.
//runOnce =1;
//$(".accordion2 .Myheader").eq(2).removeClass("active");
//$(".accordion2 .Myheader").eq(2).addClass("active");
//$(".accordion2 p").eq(2).show();
//$(".accordion2 .Myheader").remove();
$(".accordion2 .Myheader").unbind("click");
$(".accordion2 .Myheader").click(function(){
$(this).next(".MyMenuBody").slideToggle("slow")
.siblings(".MyMenuBody:visible").slideUp("slow");
$(this).toggleClass("active");
$(this).siblings(".Myheader").removeClass("active");
});
// second child
//$(".MyMenuBody .Myheader2").eq(2).addClass("active");
$(".MyMenuBody .Myheader2").unbind("click");
$(".MyMenuBody .Myheader2").click(function(){
$(this).next(".MyMenuBody .MyMenuBody2").slideToggle("slow")
.siblings(".MyMenuBody2:visible").slideUp("slow");
$(this).toggleClass("active");
$(this).siblings(".Myheader2").removeClass("active");
});
}
}