tags:

views:

52

answers:

2

hi

in my asp age I'm using javascript that is below, I want to post data from one page to another using javascript post method?

below is the javascript i using..

In "test1.asp" page

<script type="text/javascript">
function Service_Add(Data_ID,Data_Type)
{
var Data_ID=Data_ID;
var Data_Type=Data_Type;

document.miformulario.submit();// here i wand to pass data some thing like this "Submit(Data_ID,Data_Type)"
}
</script>

I want to post "Data_ID" and "Data_Type" to my Test2.asp page

how i solve this problem? hoping for your response

+2  A: 

To pass data when you submit a form, you have to include that data in a form input field (hidden, visible, doesn't matter).

David M
problem is test1.asp input field names are not constant
Alex
xmlHttp.open("POST","test2.asp",true); xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlHttp.setRequestHeader("Content-length", params.length); xmlHttp.setRequestHeader("Connection", "close"); xmlHttp.send(params);this is the type i using in javascript/ ajax
Alex
there is some thing like this in javascript
Alex
You aren't submitting a Javascript form. You're submitting an HTML form using Javascript (and that's the only way to do it). To send data in an HTML form, you need the data in an HTML input.
Gareth
+2  A: 

You can add hidden fields in your HTML form like this

<input type="hidden" id="Data_ID">
<input type="hidden" id="Data_Type">

and then set the values in your javascript function and then submit (?)

<script type="text/javascript">
function Service_Add(Data_ID,Data_Type)
{

document.getElelementByID("Data_ID").value=Data_ID;
document.getElelementByID("Data_Type").value=Data_Type;

document.miformulario.submit();

}
</script>
Shoban