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>
Try this:
It is important to use the absolute path (
/pdp/policy-info). Not the relative one (pdp/policy-info).