right now I'm successfully passing one value to a Bootstrap modal via AJAX, however when I attempt to pass a second value my code stops working.
JavaScript
function claimOrder(str, stre){
if (str=="") {
document.getElementById("txtH").innerHTML="Blank Order ID";
return;
}
if (stre=="") {
document.getElementById("txtH").innerHTML="Blank User ID";
return;
}
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 (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtH").innerHTML=xmlhttp.responseText;
}
}xmlhttp.open('GET','assignuser.php?q='+str'&w='+stre,true);
xmlhttp.send();
}
Button That Triggers Function
echo '<td><a data-toggle="modal" href="#mModal" onclick="claimOrder('.$order_id.', '.$activeuser.')" class="btn btn-success btn-lg">Claim</a></td></tr>';
Modal Called by Button
<div class="modal fade" id="mModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div id="txtH"><b>Loading...</b></div>
</div><!-- /.modal -->
PHP
<?php
$q = intval($_GET['q']);
$w = intval($_GET['w']);
etc... No changes were made to the PHP that worked before adding the second variable to the AJAX call except the extra line defining $w. If I remove the extra parameter from the function and function call line assignuser.php runs fine and the modal is populated, so I'm pretty sure the problem is somewhere in the JavaScript.