我有以下通过参数接收customerID的Javascript代码段(我将解释发生了什么):
function purchaseEntry(customerid) {
$('customeridfield').value = customerid;
if (approvedAgents()) {
e1 = $('entrylisttable');
e1.hide();
getExistingDetails(customerid, 'confirmstatusexistingdetails');
$('confirmstatushajjlicenceno').value = '';
$('confirmstatusapproved').checked = false;
e1 = $('confirmstatus');
e1.show();
}
return false;
}
function getExistingDetails(customerid, existingdetails) {
e1 = $(existingdetails);
e1.innerHTML = 'Loading ... <img src="/jpg/ajaxloader.gif" />';
var url = '/samex/index.php';
var pars = 'option=com_directory&view=entry2&customerid=' + customerid + '&format=raw';
new Ajax.Request(url, { method: 'get', parameters: pars,
onSuccess: function(request) {
var json = request.responseText.evalJSON();
jsondata = json['data'];
e1 = $(existingdetails);
e1.innerHTML = jsondata['clientdata'];
},
onFailure: function(request) {
e1 = $(existingdetails);
e1.innerHTML = 'Unable to get information for customer ' + customerid;
}
});
}
HTML如下所示:
<a href="#" onclick="return purchaseEntry('39384');">
输出如下:
Name: ABC
Address: 123 Street
City: none
Post Code: none
源代码(将单页保存到我的电脑后):
<div id="confirmstatus" class="optiondiv" style="">
<form id="confirmstatusform">
<table cellspacing="0">
<tbody><tr><td><span class="tableentryhead">Your details in our existing record</span></td>
</tr>
<tr><td><div id="confirmstatusexistingdetails" class="existingdetails">
<table cellspacing="0"><tbody>
<tr>
<td>Name:</td><td>XXXXXXXXXX</td></tr>
<tr><td>Address:</td><td> XXXXXXXXXX </td></tr>
<tr><td>City:</td><td>XXXXXXXXXX</td></tr>
<tr><td>Postcode:</td><td>XXXXXXXXXX</td><
/tr><tr><td>Country:</td><td>XXXXXXXXXX</td></tr>
<tr><td>Telephone:</td><td>XXXXXXXXXX</td></tr>
<tr><td>Fax:</td><td>XXXXXXXXXX</td></tr>
<tr><td>EMail:</td><td>XXXXXXXXXX</td></tr>
<tr><td>Web site:</td><td>XXXXXXXXXX</td></tr>
</tbody></table></div></td></tr>
</tbody></table>
问题:
我需要使用PHP通过循环左右将输出值XXXXXXXXXX插入到PHP数组中。
有任何建议吗?
答案 0 :(得分:0)
for($i++)
<tr>
<td>Name:</td><td><?php 11 ?></td></tr>
<tr><td>Address:</td><td> <?php 11 ?> </td></tr>
在php中使用它并回显整个字符串so.whole你可以在js中获得js .Put ajax响应。