[jQuery] javascript server response
Yes like you said it works fine for SHORT variables, but for large amounts
of text it's more difficult.
Because of the SERVERSIDE problems involved.
I have to escape all variables (add slashes) if i insert them in javascript
immediately. This requires that I use echo to output the contents (PHP)
instead of just writing it in the html.. It makes for messy serverside code.
It's difficult to explain since I'm not english.
Does anyone have a solution still?
>From: "Aloyzas Rimeika" <neytema@gmail.com>
>Reply-To: "jQuery Discussion." <discuss@jquery.com>
>To: "jQuery Discussion." <discuss@jquery.com>
>Subject: Re: [jQuery] javascript server response
>Date: Sun, 30 Jul 2006 21:47:29 +0300
>
>I don't understand why do something so complicated?
>Isn't easier just to write simple javascript like this:
>
><script type="text/javascript">
>var comment = "varcontents goes here";
>var blabla = "contents goes here";
>
>$('#comments').innerHTML = comment;
></script>
>
>As I see in RJS Templates example
>(http://www.codyfauser.com/articles/2005/11/20/rails-rjs-templates)
>folowing code can by rewriten in jQuery:
>
>Example from page:
>page.insert_html :bottom, 'list',
> content_tag("li", "Fox")
>page.visual_effect :highlight, 'list', :duration => 3
>page.replace_html 'header',
> 'RJS Template Test Complete!'
>
>Translation to jQuery:
>$('#list')
> .append("<li>Fox</li>")
> .highlight(3000);
>$('#header')
> .html("RJS Template Test Complete!");
>
>So is there a point do somthing like RJS Templates then you have jQuery?
>
>On 7/30/06, Mr Xia <mr_xia@hotmail.com>