I have code that looks something like this:
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
function myButton_click(){
alert('got here');
$.get("myPage.cfm", function(data){alert('load was performed')});
}
</script>
</head>
<body>
<input type="button" id="myButton" value="My Button" onClick="myButton_click()" />
</body>
</head>
The first alert (“got here”) shows up, but the “load was performed” doesn’t. Is the get being executed? What am I doing wrong?
Edit:
I’ve tried it with “http://www.google.com” instead of “myPage.cfm” to make sure it’s not a problem with my page and it’s still not alerting…
According to the docs, the function you pass as the second parameter to the
$.getcall is only called on success. So if your server is returning any kind of error (400, 403, 404, 500 etc.), that function will not be called. If you want a function to be called no matter what, usecomplete: