AJAX调用以击中URL

I need to hit a page using an AJAX call

$.ajax({
    url: '/path/addId?type=one&id=' + $("#id").val(),
    type: "POST",
    success: function(data){
      alert(data[message]);
    },
    error: function(data){
      alert("error!");
    }
});

I'm getting an error for this. What is the basic configuration required to hit external URL?

UPDATE:

Here's the response I'm getting or error:

readyState
getResponseHeader
getAllResponseHeaders
setRequestHeader
overrideMimeType
statusCode
abort
state
always
then
promise
pipe
done
fail
progress
complete
success
error
respondedText
status
statusText

If you are getting the alert window saying 'error!', it means that your ajax request was being sent successfully, but that the server is responding with an error, or not at all.

This could be for a number of reasons, but I would firstly check that your URL is correct.

What Bigood said is true.. you are getting confused between POST and GET.

To use GET use below code:

$.ajax({
 url: '/path/addId?type=one&id=' + $("#id").val(),
 type: "GET",
 success: function(data){
  alert(data[message]);
 },
 error: function(data){
  alert("error!");
 }
});

to use POST use below code

var id=$("#id").val();
$.ajax({
 url: '/path/addId',
 type: "POST",
 data: {type:'one',id:id},
 success: function(data){
  alert(data[message]);
 },
 error: function(data){
  alert("error!");
 }
});// indentation