Home > Web Front-end > JS Tutorial > body text

How to use js to pass array parameters to the background controller

php中世界最好的语言
Release: 2018-05-26 11:47:30
Original
2224 people have browsed it

This time I will show you how to use js to pass array parameters to the backend controller, and how to use js to pass array parameters to the backend controller. What are the precautions?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();
Copy after login

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

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:

How to use Vue.js form control

How to use js to transfer Json between front and backend

The above is the detailed content of How to use js to pass array parameters to the background controller. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template