AJAX ResponseText调用

AJAX ResponseText调用

问题描述:

请帮助我解决所有问题.ResponseText对象包含以下文本,例如1 Nestle Dairy 10;其中1是ProductID字段,Nestle是Product字段,Dairy是Category字段,而10是字段中的数量.我必须在四个输入框中表示它们.我想像文档一样显示它们.getElementByID("txtProdID").value = ResponseText.仅带文本的内容,当空间到达时,它会到达另一个空间输入.感谢和问候.上帝保佑大家.

Kindly help me with this matter.Everything has been done.The ResponseText object contains the following text for example 1 Nestle Dairy 10;where 1 is the ProductID field, Nestle is the Product field,Dairy is the Category field and 10 is the quantity in hand field.I have to represent them in four input boxes.I want to show them like that document.getElementByID("txtProdID").value=ResponseText.Something which brings only texts and when space comes it reaches towards the other input.Thanks and regards.God bless you all

在JavaScript中为字符串定义了split()方法.您可以拆分响应,然后使用数组填充文本框.

看这里:
MSDN:拆分方法(JavaScript) [ ^ ]
JavaScript split()方法 [
There is a split() method defined for strings in JavaScript. You can split the response and then use the array to fill textboxes.

Look here:
MSDN: split Method (JavaScript)[^]
JavaScript split() Method[^]

Sample:
fullProduct = ResponseText;
var splitProduct = fullProduct.split(' ');



试试吧!



Try!