icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.
Old February 10th, 2007, 5:38 PM   #1 (permalink)
Registered User
Fresh Surpasser
 
Jacek Czapla's Avatar
 
Joined in Aug 2004
Lives in Poland
Hosted on pass7
21 posts
Gave thanks: 0
Thanked 0 times
AJAX from prototype 1.5 final does'n work

Hi
I use prototype 1.5 final library and I have problem with AJAX requests (all returns error 403). In prototype 1.5 Release Candidate 0 AJAX requests works correct.
The problem occurs only on Surpass account.
On my local machine and other servers (i checked 2 servers from different firms) prototype 1.5 final works correct so I'm afraid it may be the server configuration error.

Had anyone got similar problem? Any solutions?
__________________
Jacek Czapla<br/>
pass60
Jacek Czapla is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old February 10th, 2007, 9:23 PM   #2 (permalink)
﴾͡๏̯͡๏﴿...tweet
Super #1
 
Joined in Dec 2005
5,738 posts
Gave thanks: 145
Thanked 151 times
we'd have to know more about what you are using prototype js for ... like maybe give us a script example etc....
__________________
poof
Brandonnn is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old February 11th, 2007, 8:09 AM   #3 (permalink)
Registered User
Fresh Surpasser
 
Jacek Czapla's Avatar
 
Joined in Aug 2004
Lives in Poland
Hosted on pass7
21 posts
Gave thanks: 0
Thanked 0 times
OK. This is link element with ajax request.
As you can see onClick returns null, and link behavior is done by Event.observe function from Prototype library. This code is generated by helper method of CakePHP Framework.

<a href="/clientgroups/index" id="link23617" onclick=" return false;">Client groups</a><script type="text/javascript">Event.observe('link23617', 'click', function(event){ new Ajax.Updater('content-center','/clientgroups/index', {asynchronous:true, evalScripts:true, requestHeaders:['X-Update', 'content-center']}) }, false);</script>

I found an answer.
Prototype 1.5 final send this content-type header

Content-Type: application/x-www-form-urlencoded; charset=UTF-8

version 1.5 RC0 send

Content-Type: application/x-www-form-urlencoded

IO changed the Prototype code (class Ajax.Request.Events method setRequestHeaders)

from:

headers['Content-type'] = this.options.contentType +
(this.options.encoding ? '; charset=' + this.options.encoding : '');

to:

headers['Content-type'] = this.options.contentType;

Now all works correct. Thanks for bring me to thinking. :-)
__________________
Jacek Czapla<br/>
pass60
Jacek Czapla is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old February 11th, 2007, 7:34 PM   #4 (permalink)
﴾͡๏̯͡๏﴿...tweet
Super #1
 
Joined in Dec 2005
5,738 posts
Gave thanks: 145
Thanked 151 times
cool glad you got it all worked out.
__________________
poof
Brandonnn is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On