Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

JQuery Advanced Form Posting help


  • Please log in to reply

#1
Immortalarena

Immortalarena

    Member

  • Member
  • PipPipPip
  • 216 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

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP