The aim is to show a form which will update the div on the page with the result
- load this [page]
- click the linkto show the form
- submit the form
When submitting, the result does not show in the div if the form had been hidden.
after adding the code suggested in the below answers, I show the form, it gets submitted, but the data is not appearing in the div I give the ajaxForm as target
[Here] is the same form that does show the result in the div
Thanks
In the example that doesn't work, if you bind the ajaxForm when you display the form it should work fine.
Add above instead of
jQuery.facybox({ div: '#formDiv' }); return false
and it should work as expected.I'm not sure, but may be you init form with the wrong id?
When form id is
feditform
. And in the correct example located on http://plungjan.name/eetest/facy.html$('#feditform').ajaxForm(options);
When you submit the form, the request is sent to the server and you obtain a HTTP Error:
405 Method Not Allowed
.It looks like it comes from the configuration of your server. http://www.checkupdown.com/status/E405.html
Edit: as your code works for your example in the facy.html page I think it doesn't really comes from the server. The difference between the two examples are the action of the form.
Did you try to call your thank you page "thanks.php" and modify the action of your form accordingly. I suppose that your server might not allow POST request on an HTML page.
The data did appear for me in the link you posted.
If you think it is related to plugin conflict try jquery.noConflict() http://api.jquery.com/jQuery.noConflict/
While not the most elegant solution. It easily fixes any conflicts you have with plugins.
As far as I can see you now have:
<div id="formDiv" style="display:none"> some other code here </div>
but you still call
$('#feditform').fadeIn('slow').ajaxForm(options);
as far as I can see and know about jQuery this will never show up, because the surrounding div is
display:none
. I suggest to do three things:hide()
andshow()
, which will avoid trouble with some animations. If this works, you can go on and introduce the animated versions again.(document).ready
function via jQuery, so you can rely on those functions. We had bad experiences with 'mixed' approaches (hardcoded and via jQuery) especially concerning show and hide situations.$
. We tend to use the keywordjQuery
in those situations because this will always keep the scope.Hope this helps.
I don't think your problem is jQuery/Javascript related.
Once the form is submitted (through PHP I presume?) you need to echo a message which will be passed as part of the success callback. i.e.
Care to post your server side code?