How to assign a variable in jquery to php. I tried it for half a day. $ ('. Sendj'). click (function (){
// Var len = $ ("# group span"). size (); // Obtain the number of span tags
Var arr = [];
For (var index = 0; index <5; index ++) {// create a number array
Arr [index] = index;
}
Var a_inter = [];
$. Each (arr, function (I) {// cyclically obtain values of different IDs
Var idValue = $ ("li. selected"). eq (I). attr ("id ");
If (idValue! = ''){
A_inter [I] = idValue;
}
});
D = a_inter.toString (); // Convert the array to a string.
$. Post ("getselect. php", {selectdata: d}, function (data ){
});
});
This is d.
Reply to discussion (solution)
$. Post ("getselect. php", {selectdata: d}, function (data ).....
You submit
$.post("getselect.php",{selectdata:d},function(data) { alert(data);});
Getselect. php
Getselect. php requires $ _ POST ['selectdata']; to receive the post parameter, the name of the post parameter should be selectdata
It seems like an environment problem. One day.