My code is like this:
<script type="text/javascript">
$(document).ready(function(){
$("Edit").click(function(){
$.get('fetchvalues.php');
});
});
</script>
<input id="Edit" name="Edit" value="Edit Record" type="button" onclick="$.get('fetchvalues.php');" />
In the file “fetchvalues.php”, I have written some code along with the javascript alert window to see whether the control reaches there. But nothing is happening.
Am I calling correctly?
This should be:
And if you have that you don’t need it again in the
click=""HTML attribute.Also try your debugging
alertwith:Also it’s not very clear to me where you put the alert() in your original code. In the HTML code outputted from fetchvalues.php ? If yes then it will never be executed; you would have to load the file by adding a directive to your html file through javascript.
EDIT: Answering question asked in the comments here for better formatting.
You could temporarily erase all the code in
fetchvalues.phpand replace it with:After that, replace your
$.getwith:That should
alert()“Whatever you want”!Live demo: http://koper.wowpanda.net/so.html