-4
$.ajax({
  u r l: "exampl.com",
  type: "GET",
  dataType: "jsonp",
  success: function (msg) {
    console.log(msg);
  }
});
T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
  • 1
    Welcome to Stack Overflow! Please take the [tour], have a look around, and read through the [help], in particular [*How do I ask a good question?*](/help/how-to-ask) Amongst other things, you need to ask a question. Also, the full content of your question must be **in** your question, not just linked. The question must be answerable without following the links, because links rot, and people shouldn't have to follow random links to help you. – T.J. Crowder Mar 16 '16 at 09:19
  • May be a duplicate of [*json Uncaught SyntaxError: Unexpected token :*](http://stackoverflow.com/questions/7936610/json-uncaught-syntaxerror-unexpected-token), as the OP says they really have `url` rather than `u r l`. – T.J. Crowder Mar 16 '16 at 09:35

1 Answers1

0

Identifiers in property initializers cannot have spaces in them unless they're in quotes:

$.ajax({
  u r l: "exampl.com",
//^^^^^----------------------------- Remove the spaces
  type: "GET",
  dataType: "jsonp",
  success: function (msg) {
    console.log(msg);
  }
});
T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
  • Here's what I wrote with spaces – Mark Petrosyan Mar 16 '16 at 09:28
  • use `url` instead of `u r l` – Satish Kumar sonker Mar 16 '16 at 09:29
  • $.ajax({ url: "exampl.com", type: "GET", dataType: "jsonp", success: function (msg) { console.log(msg); } }); – Mark Petrosyan Mar 16 '16 at 09:33
  • 1
    @MarkPetrosyan: There are spaces in the code you put in your question. We can only work with the information you give us. If you actually have `url` rather than `u r l`, why waste everyone's time by putting `u r l` in the question? If you actually have `url`, sounds like this is a duplicate of [this question and its answers](http://stackoverflow.com/questions/7936610/json-uncaught-syntaxerror-unexpected-token). – T.J. Crowder Mar 16 '16 at 09:33