Jump to content

Not reloading page after php form submit


hatefulcrawdad

Recommended Posts

in your php file change all occurrences of this

 

<div class="email-err">

 

to this

 

<div class="email-err" id="email-err">

 

your response handler should be the following

function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
        $('contact-content').set('html',response+$('contact-content').get('html'));
        $('email-err').fade('out');
    }
}

 

I think that should work if you do everything right

 

wow, your good. it worked alright but I would like it to stay for a couple second, then fade out. Also, the space for it stays after it faded away. Is there a way to add something that makes it go to display:none; or somethign after it fades? Sorry if Im buggin  you, but i really am learning from all this. it is making me seriously want to dedicate some time to learn these programming languages.

Link to comment
Share on other sites

change this

 

 $('email-err').fade('out');

 

to

 

setTimeout(function() {    $('email-err').fade('out');}, 5000);

 

will fadeout after 5 seconds

 

awesome, now i gotta figure out how to get rid of the space created by the div. some kind of function that sets the display to none of that div after it fades out. ill search google, but if you have the time and know how, let me know.

Link to comment
Share on other sites

awesome! I think i did it by myself! I used the following handleResponse

 

function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
        $('contact-content').set('html',response+$('contact-content').get('html'));
        setTimeout(function() {    $('email-err').fade('out');}, 2000);
	setTimeout(function() {    $('email-err').setStyle('display', 'none');}, 2500);

}
}

Link to comment
Share on other sites

yes even better remove the node itself :)

function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
        $('contact-content').set('html',response+$('contact-content').get('html'));
        setTimeout(function() { $('email-err').fade('out');}, 2000);
        setTimeout(function() { $('email-err').destroy();}, 2500);
    }
}

Link to comment
Share on other sites

yes even better remove the node itself :)

function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
        $('contact-content').set('html',response+$('contact-content').get('html'));
        setTimeout(function() { $('email-err').fade('out');}, 2000);
        setTimeout(function() { $('email-err').destroy();}, 2500);
    }
}

 

i just tested in IE 8 and it doesn't work. The form still puts the info in the URL, do you have any idea why it would do that?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.