dezwald
2008-May-20 16:26 UTC
script tags won''t display in textarea box using ajax request.
hi there, i have a textarea box that i want to be able to save javascript code into a database. (which i have no problems doing) my problem is displaying the javascript code/script tags in my textarea after retreiving it from my database via ajax request. it won''t show: <script>blah blah blah</script> i know that the js code/script tags are being retreived from the database because i can inspect ajax repsonse and see the script tags. i set the evalScripts var to false so that it will not evaluate js code and still i see nothing in my text area box. the only thing that will show is any text outside of the script tags. any help? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
yuan yudistira
2008-May-20 16:58 UTC
Re: script tags won''t display in textarea box using ajax request.
Hi, I think you should convert <script>blah </script> into <script > blah </script> If you use PHP, use htmlspecialchars function example : <?php $new = htmlspecialchars("<a href=''test''>Test</a>", ENT_QUOTES); echo $new; // <a href='test'>Test</a> ?> Thanks YUAN On Tue, May 20, 2008 at 11:26 PM, dezwald <paul.diez-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > hi there, > > i have a textarea box that i want to be able to save javascript code > into a database. (which i have no problems doing) > > my problem is displaying the javascript code/script tags in my > textarea after retreiving it from my database via ajax request. it > won''t show: > > <script>blah blah blah</script> > > i know that the js code/script tags are being retreived from the > database because i can inspect ajax repsonse and see the script tags. > > i set the evalScripts var to false so that it will not evaluate js > code and still i see nothing in my text area box. > > the only thing that will show is any text outside of the script tags. > > > any help? > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Walter Lee Davis
2008-May-23 14:39 UTC
Re: script tags won''t display in textarea box using ajax request.
If you have the script already in your response, then run escapeHTML () on it in JavaScript. (Does the same thing as htmlspecialchars() in PHP.) Walter On May 20, 2008, at 12:58 PM, yuan yudistira wrote:> Hi, > > I think you should convert <script>blah </script> > into > <script > blah </script> > > If you use PHP, use htmlspecialchars function > > example : > > <?php > $new = htmlspecialchars("<a href=''test''>Test</a>", ENT_QUOTES); > echo $new; // <a href='test'>Test</a> > ?> > > > Thanks > > YUAN > > > On Tue, May 20, 2008 at 11:26 PM, dezwald <paul.diez-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > hi there, > > i have a textarea box that i want to be able to save javascript code > into a database. (which i have no problems doing) > > my problem is displaying the javascript code/script tags in my > textarea after retreiving it from my database via ajax request. it > won''t show: > > <script>blah blah blah</script> > > i know that the js code/script tags are being retreived from the > database because i can inspect ajax repsonse and see the script tags. > > i set the evalScripts var to false so that it will not evaluate js > code and still i see nothing in my text area box. > > the only thing that will show is any text outside of the script tags. > > > any help? > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---