how to submit a value to another page without using the form tag [JAVASCRIPT]

advertisements

Hii Everyone can help me ? How to submit value to another page without using form tag (method=post), so only using javascript.

function runScript(e) {
   if(e.keyCode==13){
      var text=document.getElementById('edtsearch').value
      // bla bla must be filled with function to submit value
   }
   return false
}


With jquery library:

You can use jquery POST request.

$.ajax({
  type: "POST",
  url: url,
  data: data,
  success: success,
  dataType: dataType
});

WITHOUT LIBRARY, JUST PLAIN JAVASCRIPT.

window.location = "http://www.page.com"; //this get another page

form=document.getElementById('formName'); //this fills the form
        form.target='_blank';
        form.action='whatever.html';
        form.submit();
        form.action='whatever.html';
        form.target='';