How to send data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • koyanpaing
    New Member
    • Mar 2010
    • 26

    How to send data

    Hi everyone,

    I want to send my data when i click submit to the other page.
    I have a variable named count in javascript(js) file and i want to send that variable.

    Thanks and regards
    Yan Paing
  • RamananKalirajan
    Contributor
    • Mar 2008
    • 608

    #2
    Hi Yan Paing,
    You have to add as a parameter in the url and send it. Otherwise you can create a hidden element in the form and append it and post it

    ex:

    Code:
      var myForm = document.getElementById('myForminHTML');
    
      var newElement = document.createElement("input");
      newElement.type="hidden";
      newElement.name='countVar';
      newElement.id='countVar';
      newElement.value=count;
    
    
      myForm.appendChild(newElement);
      myForm.submit();
    The above code will help you in sending/submitting a variable.

    Thanks and Regards
    Ramanan Kalirajan

    Comment

    • koyanpaing
      New Member
      • Mar 2010
      • 26

      #3
      Thanks Ramanan Kalirajan

      Comment

      Working...