Here is a js function i have in which I would like to make a xmlhttp.open call using the parameter value
<script>
function showStudents(str) {
if (str == "") {
document.getElementById("stuList").innerHTML ="";
return;
} else {
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("stuList").innerHTML = xmlhttp.responseText;
}
else if (xmlhttp.readyState == 4 && xmlhttp.status == 404) {
document.getElementById("stuList").innerHTML = 'Invalid URL';
}
}
xmlhttp.open("POST", "<?php echo site_url("/rhadmin/testing/"); ?> + str ",true);
xmlhttp.send();
}
}
</script>
If the value of the 'str' parameter is 6 - then the final url should be http://localhost/rhadmin/testing/6
What do I need to do to get this?
Appreciate any help on this. Thank you.