Home >Web Front-end >JS Tutorial >How to pass array to background controller
This time I will show you how to pass an array to the background controller, and what are the precautions for passing the array to the background controller. The following is a practical case, let's take a look.
Pass the parameter to pass the 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(" , "); Split 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]+"|"); }
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
vue axios request interception
Convert the html string to HTML tags and use
The above is the detailed content of How to pass array to background controller. For more information, please follow other related articles on the PHP Chinese website!