Forum Moderators: open
jQuery.fn.ajax = function(whichID, url, query_string) {
if (url) {
$(document).ready(function() {
$('#' + whichID).load(url, query_string);
});
}
}
load('whatever.php?var1=this&var2=that') var_dump($_GET); $('#' + whichID).load(
"whatever.html?" + $.param({
var1: "this",
var2: "that"})
);
jQuery.fn.ajax = function(whichID, url) {
$(document).ready(function() {
alert(url);
$('#' + whichID).load(url);
});
}
jQuery.fn.ajax = function(whichID, url) {
var query_string = this_url.substring(url.indexOf('?') + 1);
if (query_string) {
var qsStr = '';
var qsArr = query_string.split("&");
for (i = 0; i < qsArr.length; i++) {
var qs_data = qsArr[i].split('=');
qsStr += qs_data[0] + ': "' + qs_data[1] + '", ';
}
qsStr = qsStr.replace(/([,\s]+$)/, '');
}
$(document).ready(function() {
$('#' + whichID).load(
this_url + '?' + $.param({ qsStr })
);
});
}
jQuery.fn.ajax = function(whichID, url) {
// have to remove the ? manually or it thinks "var1" is "?var1"
var this_url = url.substr(0, url.indexOf('?'));
var query_string = url.substring(url.indexOf('?') + 1);
$(document).ready(function() {
$('#' + whichID).load(
this_url + '?' + $.param({ query_string })
);
});
}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.js"></script>
<script>
jQuery.fn.ajax = function(whichID, url, refreshRate, noh) {
if (url) {
// Variable "noh" lets the system load from cache; this forces a fresh page
if (!noh) url += (new Date).getTime();
var this_url = url.substr(0, url.indexOf('?'));
var query_string = url.substring(url.indexOf('?') + 1);
$(document).ready(function() {
//// This includes the query_string, and doesn't work
url
//// This separates the query_string, and works
// this_url + '?' + $.param({ query_string })
});
//// Untested
// if (refreshRate)
// setTimeout("$().ajax('" + whichID + "', '" + url + "', " + refreshRate + ")", refreshRate);
}
else document.getElementById(whichID).style.display = 'none';
}
</script>
<div class="left d_main_con"
onMouseOver="this.style.cursor= 'pointer';"
onClick="
toggle(event, 'county_box');
$().ajax('county_box', 'http://www.example.com/includes/whatever.php?default=example&select=example&ddID=county_menu&dd_more=margin-left: 50px', '', '1');">
<span style="margin-right: 3px">EDITION: Site Name</span>
<span class="d_main_arrow">▼</span>
<div id="county_box" class="abs" style="display: none"></div>
</div>