I am having trouble with the function ShowResponse action on my Ajax Form. I am trying to show a simple message in the #show div once the form has been submitted. The Ajax submission is working okay and I can get an alert to work but I cant get the #show div to display. My code looks like this,
<script type="text/javascript" src="/uploads/JS/jquery.form.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var options = {
target: '#contact_form_94',
success: showResponse
};
$('#m477famoduleform_2').ajaxForm(options);
});
function showResponse(responseText, statusText, xhr, $form) {
alert('status: ' + statusText + '
responseText:
' + responseText +
'
The output div should have already been updated with the responseText.');
}
</script>
If anyone could help that would be great. As a minimum I would just like to replace the form with a 'Success' message.
Thanks
Chris
Does it work if you include the showResponse function within the $(document).ready?
If you are saying you can alert the response and can see it then I think #show
does not exist on the page. Try to alert $('#show').length
and see what you get.