I am just starting to learn the basics of jQuery and AJAX. I have already attempted to solve this problem by checking previous answers on Stackoverflow, but the code provided did not work for me. I have created two pages, index.php and testing.php, with a button on the index page. However, when I click on the button, nothing happens and it does not pass to testing.php. I am using jQuery and AJAX functions for this.
HTML file (index.php)
<input type='submit' name='Result' value='Show Graph' id='Result' onclick='return go_graph();'/>
I have also tried calling the function in JavaScript, but it is not working.
jQuery File
<script type="text/javascript">
$(document).ready(function(){
alert(projectID);
$('#Result').click(function(){
var clickBtnValue = $(this).val();
$.ajax({
url: "testing.php?projectID="+projectID+"&clickBtnValue="+clickBtnValue,
success: function(results){
res=results;
alert('haii');
},
});
});
function go_graph(){
alert(projectID);
$.ajax({
url: "testing.php?projectID="+projectID,
success: function(results){
res=results;
alert(res);
},
});
}
});
</script>