Note that there are some explanatory texts on larger screens.

plurals
  1. POPrototype AJAX picking up Wrong response from PHP
    primarykey
    data
    text
    <p>I have a really confusing problem. I have a PHP script that polls another PHP script through Prototype. Now when I poll this page once everything is fine and it all reponds fine but when I poll a second time it returns an odd reponse.</p> <p>What I have is a piece of text:</p> <pre><code>blah &amp;pound; &amp;pound; </code></pre> <p>Now when this goes through Prototype first time around it encodes the string correctly using the escape function. Full code is displayed here (escape_function variable is id_opt['escape_function']):</p> <pre><code>escape_function: escape, // or encodeURIComponent var new_text = id_opt['escape_function']($F(id + '_edit')); var params = 'id=' + id + '&amp;content=' + new_text; if(id_opt['type'] == 'select') { params += '&amp;option_name=' + $(id + '_option_' + new_text).innerHTML; } var ajax_req = new Ajax.Request( id_opt['save_url'], { method: 'post', postBody: params, onSuccess: function(t) { alert(t.responseText); EditInPlace._saveComplete(id, t); }, onFailure: function(t) { EditInPlace._saveFailed(id, t); } } ); </code></pre> <p>The polled php page saves the information (the piece of text) to db and reponds with the text. Prototype then sets the contents of a div to the returned text.</p> <p>When I go to submit it again everything is fine until the alert(t.responseText); when prototype shows some unkown characters in place of the &pound;. The strangest thing is the information in the database field is still blah £ £ (which is correct) but prototype responds with blah (?) (?) (the (?) symbols are the unkown symbol deliminators).</p> <p>I have come to the conclusion that PHP echos the right information but for some reason prototype picks up the wrong information...but there is nothing to do that between the two which has got me really confused. Being a newb at prototype I'm not really that adept at solving this.</p> <p>Thanks for any help,</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload