I couldn't seem to find any examples in the documentation of passing a jquery variable with a load statement. I tried with and without quotes, putting the whole variable statement in, but no luck. Everything else seems to work when debugging, but not passing a variable, please take a look: Edit: I should also make it clear I tried {term: d} and {term: var d} but neither work.
<script>
function callMe() {
for (var i = 1; i< 2; i++){
var b = $('#song'+i).val();
var c = $('#artist'+i).val();
var d = b +" "+ c;
// alert(d);
//$('#results').load('getWeb.php', {term: d});
$('#results').load('getWeb.php', {term: 'd'});
}
// var b = $('#song1').val();
// alert(b);
}
$(document).ready(function(){
callMe();
});
</script>
<form>
Song <input type ="text" name ="song1" id ="song1">
Artist <input type ="text" name ="artist1" id ="artist1"><br />
<input type ='submit' value ='Submit' onClick="callMe();">
</form>
'd'in{term:'d'}so it is a variable and not a string as you have it in the commented out line. How are you trying to receive this in php?