Home  >  Article  >  Web Front-end  >  About the method of passing array parameters to the background controller in js

About the method of passing array parameters to the background controller in js

不言
不言Original
2018-06-25 15:57:321593browse

Below I will share with you a method of passing array parameters to the background controller using js. It has a good reference value and I hope it will be helpful to you. Let’s take a look together

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

The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website !

Related recommendations:

Javascript implements waterfall flow dynamic loading of images

JavaScript implements drawing graphics using Canvas

The above is the detailed content of About the method of passing 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