Home > Article > Web Front-end > How to pass array parameters to the background controller in js
This article mainly shares with you how js passes array parameters to the background controller. It mainly shares with you the code method. I hope it can help you.
Pass parameters and pass strings, so you need to convert the array into a string,
var arr=[1,23,34,5]; var str = arr.toString();
Str is passed to the background, str.split(", "); splits the string into elements.
var arr=[1,23,34,5]; var str = arr.toString(); document.write(str); var getArr = str.split(","); for(var i=0;i<getArr.length;i++){ document.write(getArr[i]+"|"); }
Related recommendations:
js implementation of passing complex json parameters to controller
The above is the detailed content of How to pass array parameters to the background controller in js. For more information, please follow other related articles on the PHP Chinese website!