The data dynamically output on the page, this is the data obtained by ajax. I want to display it on the page
success:function(data){
var arr = data.split('_');
var numArr = arr[0].split(",");
var numStr = "";
If(numArr.length==undefined || numArr.length==0){
$("#phonenolist").html('Sorry, no corresponding number was found! ');
}else{
}else{ for(var i=0;i
numStr = " numArr[i].toString() ",n_" i ");" class='buy'>"
numArr[i].toString().substring(0 , 3) numArr[i].toString(). substring(7, 11) (numStr);
}
index = arr[1]; 🎜> } ).html("" num "
");
$("#" id).addClass("buy").siblings() .removeClass("buy");
}
My parameters in js are roughly like this, choose_mobile (number, object id), but when executing js, only the number pops up , there is no ID, so I was very depressed. Later, I asked others for help. In lines 9 and 10 of the code, I added '' single quotes to the two parameters of the method,
Copy code
The code is as follows:
numStr = " numArr[i].toString() "','n_" i "');" class='buy'>"
That’s how it worked, let me be nice before I’m confused. The parsing of strings by js is still different from the parsing of numeric strings. They can be distinguished so clearly.