我有一些数据表,我想从URL
中获取param id 194admin/customer-management/updater/id/194
我的源AJAX:
"sAjaxSource": "/<?= Zend_Registry::get('Zend_Locale')->getLanguage(); ?>/admin/CustomerManagement/getlistcontactsajax/idCustomer/" + $(this).attr('value');
我执行此操作+ $(this).attr('value');
但它不起作用。
答案 0 :(得分:2)
可见,您使用PHP(使用Zend)编写js代码 您可以使用以下命令恢复控制器中的ID:
$id = $this->getRequest()->getParam('id');
所以你可以用它编写你的js代码(可能在视图中传递变量):
"sAjaxSource": "/<?=Zend_Registry::get('Zend_Locale')->getLanguage();?>/admin/CustomerManagement/getlistcontactsajax/idCustomer/<?= $id?>",
答案 1 :(得分:1)
如果你有url变量,你可以使用正则表达式url.match(/\d+$/)
来获取它
答案 2 :(得分:1)
你可以这样做:
PortfolioCollectionDataContext context = null;
context = DataContext;
var Logins = from bkg in context.EnquiryBookings
join log in context.Logins
on log.LoginID equals bkg.LoginID
&& bkg.Paid == true
join enq in context.Enquiries
on enq.EnquiryID equals bkg.EnquiryID
join estb in context.Establishments
on enq.EstablishmentID == estb.EstablishmentID
select new
{
str = "[Name: " + log.LastName + " " + log.FirstName + " - Country: " + log.CountryOfResidence + " - Phone: "
+ log.TelephoneNumber + " - Email: " + log.EmailAddress + " - Booked From: "
+ estb.CompanyName + " - Spent: " + bkg.TotalPrice.ToString() + "]"
};
string output = string.Join(", ", Logins.ToList());
return output;
或
parseInt(location.href.split("/").pop())