[Proto-Scripty] Re: Problem with responseText

2009-03-30 Thread Richard Quadling

The problem is that your editor has added this to the PHP script.

So, whereas ...

html
head
title?php echo $someTitleInPHP; ?/title
...

will echo the HTML tags with the title embedded, the BOM arrives also.

PHP5 and lower will NOT treat the BOM any different to any other content.

You will need to remove it manually. This is probably going to be down
to your editor.

2009/3/30 malstroem thomas.lacha...@gmx.de:

 Hi there,
 I am doing an ajax request with prototype.js.
 The corresponding php - file does an  echo 'success';  when
 everything is fine.
 Now I want to check with javascript if the responseText equals
 'success' and then go on with other functions...
 But the comparison does not become true, even when php echos
 'success'...
 When forwarding the responseText to a new location, it becomes '%EF%BB
 %BFsuccess' in the url
 This is the utf-8 BOM, isn´t it? Do I have to remove it before being
 able to compare the responseText?
 HOW? Thanks and kind regards
 Thomas

 new Ajax.Request('php/ajaxCalls/registrationSave.php',
  {
    method:'POST',
    parameters: params,
    onSuccess: function(transport){

     var response = transport.responseText;
     if (response == 'success')
      {
          //do somethint
      }

    },
    onFailure: function(){ alert('failure') }
  });

 




-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Problem with responseText

2009-03-30 Thread Richard Quadling

Alternatively, you could just skip the first 3 characters of the response...

response.substring(3);

http://www.w3schools.com/jsref/jsref_substring.asp

2009/3/30 Richard Quadling rquadl...@googlemail.com:
 The problem is that your editor has added this to the PHP script.

 So, whereas ...

 html
 head
 title?php echo $someTitleInPHP; ?/title
 ...

 will echo the HTML tags with the title embedded, the BOM arrives also.

 PHP5 and lower will NOT treat the BOM any different to any other content.

 You will need to remove it manually. This is probably going to be down
 to your editor.

 2009/3/30 malstroem thomas.lacha...@gmx.de:

 Hi there,
 I am doing an ajax request with prototype.js.
 The corresponding php - file does an  echo 'success';  when
 everything is fine.
 Now I want to check with javascript if the responseText equals
 'success' and then go on with other functions...
 But the comparison does not become true, even when php echos
 'success'...
 When forwarding the responseText to a new location, it becomes '%EF%BB
 %BFsuccess' in the url
 This is the utf-8 BOM, isn´t it? Do I have to remove it before being
 able to compare the responseText?
 HOW? Thanks and kind regards
 Thomas

 new Ajax.Request('php/ajaxCalls/registrationSave.php',
  {
    method:'POST',
    parameters: params,
    onSuccess: function(transport){

     var response = transport.responseText;
     if (response == 'success')
      {
          //do somethint
      }

    },
    onFailure: function(){ alert('failure') }
  });

 




 --
 -
 Richard Quadling
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 Standing on the shoulders of some very clever giants!




-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---