zend 中奇怪的表单重定向
我的表单有一个奇怪的重定向问题。
当我给出表单 action="/pdp/policy-info" 时,它会转到 /pdp/pdp/policy-info。
但是当我给出表单操作=“policy-info”时,它会转到“/policy-info”。 我希望它转到“/pdp/policy-info”,但我不确定为什么会发生这种情况。
表单的 URL 是 pdp/client-info。
<script type="text/javascript">
$(document).ready(function() {
function myrequest(e) {
var lead_id = $('#lead_id').val();
$.ajax({
method: "GET",
url: "/pdp/fetch-client-data/",
dataType: 'json',
cache: false,
data: {
lead_id: lead_id
},
success: function( responseObject ) {
if(responseObject !=null){
$('#client_name').val( responseObject.client_name );
$('#state').val(responseObject.state);
}
else{
alert('Could not find lead id!');
}
},
failure: function()
{
alert('fail');
}
});
}
$('#fetchFields').click(function(e) {
e.preventDefault();
myrequest();
});
$("#lead_id").bind("change", function(e)
{
myrequest();
});
});
</script>
<div id="client-box">
<form action ="pdp/policy-info/" method='post'>
</form>
</div>
My form has a weird redirection problem.
When I give form action="/pdp/policy-info" it goes /pdp/pdp/policy-info.
But when I give form action ="policy-info" it goes to "/policy-info".
I want it to go to "/pdp/policy-info" and I am not sure why this is happening
The url of the form is pdp/client-info.
<script type="text/javascript">
$(document).ready(function() {
function myrequest(e) {
var lead_id = $('#lead_id').val();
$.ajax({
method: "GET",
url: "/pdp/fetch-client-data/",
dataType: 'json',
cache: false,
data: {
lead_id: lead_id
},
success: function( responseObject ) {
if(responseObject !=null){
$('#client_name').val( responseObject.client_name );
$('#state').val(responseObject.state);
}
else{
alert('Could not find lead id!');
}
},
failure: function()
{
alert('fail');
}
});
}
$('#fetchFields').click(function(e) {
e.preventDefault();
myrequest();
});
$("#lead_id").bind("change", function(e)
{
myrequest();
});
});
</script>
<div id="client-box">
<form action ="pdp/policy-info/" method='post'>
</form>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
使用绝对路径(
/pdp/policy-info
)很重要。不是相对的 (pdp/policy-info
)。Try this:
It is important to use the absolute path (
/pdp/policy-info
). Not the relative one (pdp/policy-info
).