jQuery: The Write Less, Do More JavaScript Library

Ajax .get won't execute the callback function is a & is in the returning XML

View: New views
3 Messages — Rating Filter:   Alert me  

Ajax .get won't execute the callback function is a & is in the returning XML

by Kendall-19 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I've found a situation where the callback function won't run if there
is a & in the returned XML. I am calling PHP on the server side and
passing the input text. I can see through FireBug that the result set
is created, but the callback never runs. The callback will run if the
& is not present in the XML.

Does the & mean something special to XML or jQuery? Is there a way to
escape the & character?

Re: Ajax .get won't execute the callback function is a & is in the returning XML

by James-279 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I think it is reserved in XML. Try to use PHP to convert all & to
& on server-side.
Then you can decode it back on the client-side, if necessary.
Try that and see if it works.

On Jul 2, 10:07 am, Kendall <kendall.cro...@...> wrote:
> I've found a situation where the callback function won't run if there
> is a & in the returned XML. I am calling PHP on the server side and
> passing the input text. I can see through FireBug that the result set
> is created, but the callback never runs. The callback will run if the
> & is not present in the XML.
>
> Does the & mean something special to XML or jQuery? Is there a way to
> escape the & character?

Re: Ajax .get won't execute the callback function is a & is in the returning XML

by Kendall-19 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


That was it. I used the following in the PHP and didn't have to
convert it back in the Javascript.
Here's what I did.

preg_replace("%&(?!amp;)%i", "&", $value);

Thank you for the help.

On Jul 2, 6:00 pm, James <james.gp....@...> wrote:

> I think it is reserved in XML. Try to use PHP to convert all & to
> & on server-side.
> Then you can decode it back on the client-side, if necessary.
> Try that and see if it works.
>
> On Jul 2, 10:07 am, Kendall <kendall.cro...@...> wrote:
>
> > I've found a situation where the callback function won't run if there
> > is a & in the returned XML. I am calling PHP on the server side and
> > passing the input text. I can see through FireBug that the result set
> > is created, but the callback never runs. The callback will run if the
> > & is not present in the XML.
>
> > Does the & mean something special to XML or jQuery? Is there a way to
> > escape the & character?