SyntaxError: expected expression, got '<'

Solved
hcp7kuz Posted messages 238 Registration date   Status Member Last intervention   -  
hcp7kuz Posted messages 238 Registration date   Status Member Last intervention   -
Hello, I’d like to include an external file on my page with Ajax. I’ve managed to make the request, I can see the result in Firefox’s console, but I can’t display it; the following error message appears in the console: SyntaxError: expected expression, got '<'

[Text...]

And my Ajax code: $.ajax({ type: "GET", url: "http://example.com/", data: data, crossDomain: true, dataType: 'jsonp', success: function(msg){ $('#resultat').html(msg); } }); Thanks for your help, hcp7kuz

2 answers

Anonymous user
 
Which line is the problem on? Because I don’t see any relation between your function and this message.
0
hcp7kuz Posted messages 238 Registration date   Status Member Last intervention   23
 
Line 1 of the file I want to include.
0
Anonymous user
 
So it comes from the file, so we need the code of the file to understand the error.
0
hcp7kuz Posted messages 238 Registration date   Status Member Last intervention   23 > Anonymous user
 
The file has nothing to do with it; it simply returns a snippet of HTML code that I’d like to insert into my page.
0
hcp7kuz Posted messages 238 Registration date   Status Member Last intervention   23
 
Problem solved: in my Ajax request, I had set dataType: 'jsonp' instead of dataType: 'html'.
0