views:

23

answers:

1

Hi, normally my ajax functions look something like this:

function ajaxCallback(url,functionToRun)
{
if (window.XMLHttpRequest)
  {// code for new browsers
  myXMLlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6 and lower
  myXMLlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
myXMLlhttp.onreadystatechange=functionToRun;
myXMLlhttp.open("POST",url,true);
myXMLlhttp.send();
}

function getItemList(rep, sort_by_column, order_by)
{

ajaxCallback("scripts/get_item.php?rep="+ rep + "&sort_by_column=" + sort_by_column + "&order_by=" + order_by,function()
  {
  if (myXMLlhttp.readyState==4 && myXMLlhttp.status==200)
    {
    document.getElementById("main_area").innerHTML=myXMLlhttp.responseText;
    }
  });
}

I would like to somehow submit a form on that page using ajax, I looked at some tutorials / questions but they all suggest JQuery, but is there a way to include that form as a variable Or another way of submitting it, without jQuery? I can find a way around it, but I thought I'd check to see if there was some simple way of doing it.

+1  A: 

Pure JavaScript solution would be

document.getElementById('formid').submit();

or

document.formname.submit();

EDIT: You should add a JavaScript tag to your question and remove the "php" tag. It really doesn't have anything to do with PHP.

mattalexx