Home  >  Article  >  Web Front-end  >  How to pass array parameters to the background controller in js

How to pass array parameters to the background controller in js

亚连
亚连Original
2018-05-28 15:31:592619browse

Below I will share with you a method of passing array parameters to the background controller in js. It has a good reference value and I hope it will be helpful to everyone.

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]+"|");
}

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

vue data transfer--I have special implementation skills

Solving the dynamic transmission of query in vue-router Refer to the problem

Solution to the problem that the webpack local development environment cannot be accessed by IP

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn