js and javascript... i getting problem in how send array value from client side .js file to server side app.js into post request.
var = testParamterName=[],testParameterValue=[];
$("#Table1 tbody tr").each(function(rowinex){
// this basically gets the 2 column values that i require
var i=0;
$.each(this.cells,function(callIndex,cell){
if(i==2) //parameter value
{
testParamterName.push(cell.textContent);
} else if(i==3)
{
testParameterValue.push(cell.textContent);
}
i++;
});
i=0;
});
i am getting values from a table using jQuery in a file called test.js after saving the table values into two array namely 'testParameterValue' and 'testParamterName'
now i want to send these 2 array values to my server side .js file app.js
i used the module.exports = {testParameterValue , testParametername}; but this gives an error saying module not defined..
i have tried searching the web couldn't find the solution to my problem ... the closest solution i found was that .... cannot run module.exports into files that run in the browser.
i have skipped the code where i handled a click event for submit
please help me ...Thanks in advance :)
First of all you need to setup your server-side application with eg NodeJS and express. Your basic app will listen on the specific port, like localhost:3000
. Then you need to request this URL with your client-side JavaScript code. This issue is very well explained over here: How to process POST data in Node.js?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.