Hi
I have a newsletter form in the footer of every page. I want to submit that form without refreshing the page. So i am posting it using ajax.
I am using below code which works only on homepage till i dont visit the inner pages.
Dont know why its showing strange behaviour on inside pages.
Now what is happening is that this script is working perfectly on HOMEPAGE and sending and submitting data to database perfectly.
But when i go to inside pages and click the submit button, strange thing happens is
Like if i go to about us page or contact us page and these pages also have same form in the footer.
When i click the submit button on the about us page, Then the full about us page itself gets displayed in the RESULT DIV and form doesnt get submit.
When i click the submit button on the contact us page, Then the full contact us page itself gets displayed in the RESULT DIV and form doesnt get submit.
RESULT DIV (#footer_result ) is the DIV which displays the "success" OR "error" message.
SUCESS Message : Your are subscibed to newsletter
Error Message : Error submitting form.
I Dont why is this happening. I have never experienced this kind of thing.
Hope you will be able to help me.
Thanks
Vineet
I have a newsletter form in the footer of every page. I want to submit that form without refreshing the page. So i am posting it using ajax.
I am using below code which works only on homepage till i dont visit the inner pages.
Dont know why its showing strange behaviour on inside pages.
Code:
<script type="text/javascript">
$(document).ready(function() {
$("#newsignup_bt").click(function() {
$("#footer_result").show();
$("#footer_result").fadeIn(400).html('<span class="load">Loading..</span>');
$.ajax({
type: "POST",
url: "signup_footer.php",
data: $("#newslet_footer").serialize(),
cache: false,
success: function(data) {
$("#footer_result").html(data);
document.getElementById('foot_name').value='';
document.getElementById('foot_email').value='';
}
});
return false;
});
});
</script>
But when i go to inside pages and click the submit button, strange thing happens is
Like if i go to about us page or contact us page and these pages also have same form in the footer.
When i click the submit button on the about us page, Then the full about us page itself gets displayed in the RESULT DIV and form doesnt get submit.
When i click the submit button on the contact us page, Then the full contact us page itself gets displayed in the RESULT DIV and form doesnt get submit.
RESULT DIV (#footer_result ) is the DIV which displays the "success" OR "error" message.
SUCESS Message : Your are subscibed to newsletter
Error Message : Error submitting form.
I Dont why is this happening. I have never experienced this kind of thing.
Hope you will be able to help me.
Thanks
Vineet
Comment