an array of strings turn jq

Generally when we add keywords will add value when several groups of keywords how to upload it  

You can take the following format value ranging

var FTag = "" //AAA,BBB
if (FTag1 != "") {
FTag = FTag + FTag1 + ","; //AAA,
}

if (FTag1 != "") {
FTag = FTag + FTag2 + ","; //AAA,BBB,
}
if (FTag1 != "") {
FTag = FTag + FTag3 + ","; //AAA,BBB,CCC,
}
if (FTag1 != "") {
FTag = FTag + FTag4 + ","; //AAA,BBB,CCC,DDD,
}
//把AAA,BBB,CCC,DDD,最后一个,去掉 AAA,BBB,CCC,DDD
FTag = FTag.substring(0, FTag.length - 1) 

-1 symbol is to remove the last of a set of values 

AJAX will be able to use the method in this way the value passed into the background

 

 

 

 

How to call after adding it    

After adding retrieved using the following format will be able to pass it off to the value of the background with the back

//1111,222,333,444 ,号分割
var Tag = data.FTag.split(',');
for (var i = 0; i < Tag.length+1; i++) {
$("#FTag" + (i+1)).val(Tag[i]);
}

If the call reaches i = 1 then use

$("#FTag" + i).val(Tag[i-1]);
}

 

Guess you like

Origin www.cnblogs.com/yutang-wangweisong/p/11622238.html