我使用以下代码发布网址,其中字符串中的变量为特定的IP地址(xxx.xx.xx.xxx)。软件开发人员说我的代码或IP权限没有问题,但它不会工作,我告诉AJAX拒绝权限。我写的AJAX调用不正确吗?谢谢你的任何提示......
<script>
jQuery(document).on("click", "#idofbutton", function(e) {
var variable1 = jQuery("input[name='variable1']").val();
var variable2 = jQuery("input[name='variable2']").val();
var variable3 = jQuery("input[name='variable3']").val();
var variable4 = jQuery("input[name='variable4']").val();
var variable5 = jQuery("input[name='variable5']").val();
var variable6 = jQuery("select[name='variable6'] option:selected").val();
var variable7 = jQuery("select[name='variable7'] option:selected").val();
jQuery.ajax({
type: 'POST',
url: 'http://xxx.xx.xx.xxx/Admin/.functions/non_agent_api.php?source=http://www.example.com&user=USERNAME&pass=PASSWORD&function=add_lead&lead_id=XXXX&variable4=' + variable4 + '&first_variable3=' + variable3 + '&variable5=' + variable5 + '&variable2=' + variable2 + '&variable1=' + variable1,
success: function(data) {
alert('success - http://xxx.xx.xx.xxx/Admin/.functions/non_agent_api.php?source=http://www.example.com&user=USERNAME&pass=PASSWORD&function=add_lead&lead_id=XXXX&variable4=' + variable4 + '&first_variable3=' + variable3 + '&variable5=' + variable5 + '&variable2=' + variable2 + '&variable1=' + variable1);
},
error: function() {
alert('fail - http://xxx.xx.xx.xxx/Admin/.functions/non_agent_api.php?source=http://www.example.com&user=USERNAME&pass=PASSWORD&function=add_lead&lead_id=XXXX&variable4=' + variable4 + '&first_variable3=' + variable3 + '&variable5=' + variable5 + '&variable2=' + variable2 + '&variable1=' + variable1);
},
});
});
</script>