I m having a three controllers in my app:
我的应用程序中有三个控制器:
- Forms
- attributes
- Users
In my /forms/designpage I'm posting the data as:
在我的/ forms / designpage中,我将数据发布为:
$.ajax({
type: "POST",
url: "./attributes/untitledfieldname",
data: "sequence_no = " + counter + " & type = " + type,
success: function(msg){
}//success
});//ajax
Since I am having my untitledfieldname action inside Users Controller, in the URl i gave as ./attributes/untitledfieldname. But this doesn't works.
由于我在用户控制器中进行了无名域名操作,因此在URl中我给出了./attributes/untitledfieldname。但这不起作用。
Edit:
I have changed the URL .Actually my went like forms/attributes/untitledfieldname where forms is m base ctrller and attributes is my another ctrller. Now I put the Direct URL. Now it works.
我已经更改了URL。实际上我的表单/属性/ untitledfieldname表单是m base ctrller,属性是我的另一个ctrller。现在我把直接URL。现在它有效。
1 个解决方案
#1
Use something like
使用类似的东西
// ...
url: "<?php echo $html->url('/controller/action'); ?>",
// ...
Also, consider using $.post rather than $.ajax
另外,请考虑使用$ .post而不是$ .ajax
#1
Use something like
使用类似的东西
// ...
url: "<?php echo $html->url('/controller/action'); ?>",
// ...
Also, consider using $.post rather than $.ajax
另外,请考虑使用$ .post而不是$ .ajax