jQuery load and GET

The following lines of code are not building up and the variables arent being recieved on the other page, could somebody take a look.

function getval(sel) {
var id5 = sel.value;
var sid = Math.random();

if($('#myMessage').val() == ''){
$('#displayDiv').load('ajax-search-demock_3.php?order=id5&sid=sid');
}

Then this is the next page

if(isset($_GET['sid'])){$sid=$_GET['sid'];}else{$sid='';}

if(!empty($sid)){

Your query string is invalid. Give this a try.

$('#displayDiv').load('ajax-search-demock_3.php?order='+id5+'&sid=' + sid);
$('#displayDiv').load('ajax-search-demock_3.php?order='+encodeURI(id5)+'&sid=' + encodeURI(sid));

Also be sure to url encode the variables so you wont have control characters passed through.

1 Like

Thank you, all worked perfecctly, and thanks for the advice too

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.