You need to sign in to do that
Don't have an account?
URL Rewriter & JScript Remoting: Exception parsing json response: 'Unexpected token <'. Logged in?
Hello,
I am getting an error when I use JavaScript remoting and have my URLReWriter turned on on my Force.com SIte. The error does not occur when using JavaScript Remoting with the URL ReWriter turned off.
The error is as follows
Exception Error parsing json response: 'Unexpected token <'. Logged in?
I'm confused as to why this is occuring. If I have no checks for being logged in in my URL ReWriter (or visualforce page) why should this occur?
Has anyone ever come across something similar to this before? I noted the following http://salesforce.stackexchange.com/questions/4112/possible-oauth-remote-action-bug but in my case I am not using authentication on my site for the test page that I created & I'm wondering why it mentions "login".
Thanks in advance for any help on this.
Hi,
We found the cause & solution for this.
In my URL Rewriter "global PageReference mapRequestUrl(PageReference rewrittenUrl){" function if I set my pagereference as "PageReference returnPageReference = Page.MyPage;" the url rewriting will work for everything except the remote funciton.
For the Javascript remote action the pagereference should not have "/apex/MyPage" therefore thinking it needs to be logged in to function via apex pages.
To get around this use ""PageReference returnPageReference = new PageReference('../MyPage');" when setting the pagereference to return for a remote action.
This can be checked based on the rewrittenUrl. The reWrittenURL contains "apexremote'" if from a remote action.
Glad to have it sorted!
All Answers
Is it possible that URLRewriters and JavaScript Remoting currently do not work together in general?
Hi,
We found the cause & solution for this.
In my URL Rewriter "global PageReference mapRequestUrl(PageReference rewrittenUrl){" function if I set my pagereference as "PageReference returnPageReference = Page.MyPage;" the url rewriting will work for everything except the remote funciton.
For the Javascript remote action the pagereference should not have "/apex/MyPage" therefore thinking it needs to be logged in to function via apex pages.
To get around this use ""PageReference returnPageReference = new PageReference('../MyPage');" when setting the pagereference to return for a remote action.
This can be checked based on the rewrittenUrl. The reWrittenURL contains "apexremote'" if from a remote action.
Glad to have it sorted!