-
22 Sep 2010 1:56 AM #1
Uncaught SyntaxError: Unexpected token
Uncaught SyntaxError: Unexpected token
Hi,
I am trying to access the REST API of a website given the url, login name and password passed as parameters. If passed through the JSON request, a callback alert shall be prompted.
All I want to know is how can I retrieve the session Id but it returns this error "Uncaught SyntaxError: Unexpected token "
here is the sample of the code:
var makeJSONPRequest = function() {
Ext.util.JSONP.request({
url: 'http://www.site.com/rest/api/login',
callbackKey: 'callback',
params: {
loginName:'username',
password:'password',
},
callback: function(result) {
Alert('this must occur if method is passed.');
}
})
};
-
22 Sep 2010 3:12 AM #2
Does the site actually support cross domain requests? What happens when you visit that url in the browser?
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
22 Sep 2010 10:15 PM #3
The site does not support cross domain requests. when I visit the url in the browser, I get redirected to the site.
-
22 Sep 2010 10:19 PM #4
That's not really useful, the point is, what does the data returned from the site look like?
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
23 Sep 2010 2:56 PM #5
The error is indicating that the response returned by the server you are accessing is not valid JavaScript.
Aaron Conran
@aconran
Sencha Architect Development Team
-
3 Feb 2011 4:01 AM #6
Getting Error - Uncaught SyntaxError: Unexpected token
Getting Error - Uncaught SyntaxError: Unexpected token
Hi All,
I am trying to load 2 xml data as follows.
Firstly, I want to load the data from 1.xml and show all the titles in the List
Now, when the user clicks on any of the title, then I want to load another XML corresponding to that selected item from the List. say for example: user clicked on "News" title then it has to load the data from news.xml and show in another panel or detail panel...
I am able to load the data from 1.xml and show in the List. Also when the user clicks on the "News", I am able to get the selected item record.. but unable to load the "news.xml"
below is my code snippet:
var topics = new Ext.List({
.........
.........
...........
itemtap: function(view, index, item, e) // this function is executed when user selects title say News...
{
var record = view.store.getAt(index);
.........
...........
Ext.util.JSONP.request({
url: 'news.xml',
callbackKey: 'callback',
params: { },
callback: function(result) {
alert(result);
}
});
}
Hoping to get the quick solution to this prob...
-
3 Feb 2011 4:48 AM #7
No new threads?
No new threads?
Is it correct that it is not possible anymore to open a new thread?
Similar Threads
-
JSON+decode+syntaxerror
By veereshsh in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 3 Feb 2009, 7:03 PM -
XML Parsing Error: unclosed token
By cujo13 in forum Ext.nd for Notes/DominoReplies: 3Last Post: 10 Apr 2008, 5:33 PM -
Adding a Token
By boriscy in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 26 Mar 2008, 11:03 AM


Reply With Quote