This time I will show you how to pass array parameters in js. What are the precautions for passing array parameters in js? The following is a practical case, let's take a look.
Pass parameters to pass String, 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]+"|"); }
JS sends json format POST request
Detailed explanation of the method of vue packaging domain name according to parameter method
The above is the detailed content of How to pass array parameters in js. For more information, please follow other related articles on the PHP Chinese website!