Multiple render text in jquery rails


For one action of user based on condition i want to render different
texts. So how do i achieve it through jquery?
For example:

A simple posting message application:

On post button i have a post method which has security checks and other
server side checks like :

if message_text.nil? or message_text.empty? or message_text.length > 140
respond_to do |format|
format.html {
render :text=> “
Please enter message upto 140

format.xml {
render :xml=>hash_map_for_xml.to_xml(:root => “mb”)

Normal post.js.erb is:
$("#div3").html("<%= escape_javascript render ‘/messages/timeline’ %>");

which works if all is ok but how do i render messages like these when
user enters message greater than 140 characters? I have javascript
checks for them but i need these checks in case user enters it through
firebug skipping javascript.

When i see in firebug i do get the response but it is not painted on
browser as it doesnt know where to do it.

I feel i’m missing out soemthing very simple. Please let me know how can
this be achieved?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs