Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

JQuery Advanced Form Posting help


  • Please log in to reply

#1
Immortalarena

Immortalarena

    Member

  • Member
  • PipPipPip
  • 211 posts
I am using AJAX to get a page containing the form I need to submit. Once the form has been retrieved I would like to submit the page without that page refreshing.

I use the function below:
function ajaxrequestpage(asppagename,str,str2)
{
divID=str2
setHeight=str.split("DIVHEIGHT=");
  
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url=asppagename;
url=url+"?"+str;
url=url+"&divID="+divID;

url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged3;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

To call the Form into the page. That part works fine. When I attempt to submit the form however the page refreshes. I am attempting to submit the form with The JQuery Form Plugin. (Source)

<script type="text/javascript"> 
        // wait for the DOM to be loaded 
        $(document).ready(function() { 
            // bind 'myForm' and provide a simple callback function 
            $('#myForm').ajaxForm(function() { 
            alert("Thank you for your comment!"); 
        }); 
    }); 
</script> 

If I put the form in the page directly I am able to submit the form without the page loading, but because I am pulling a page externally with AJAX it submits and refreshes the page.

Any ideas?

Thanks!
  • 0

Advertisements







Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP