# How to check type of ajax response

**URL:** <https://www.ruby-forum.com/t/how-to-check-type-of-ajax-response/176203>\
**Category:** Rails\
**Created:** [September 26, 2009, 11:30am UTC](https://www.ruby-forum.com/t/how-to-check-type-of-ajax-response/176203 "2009-09-26T11:30:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bgumbiker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/278dde/32.png) [@bgumbiker](https://www.ruby-forum.com/u/bgumbiker)\
**Post date:** [September 26, 2009, 11:30am UTC](https://www.ruby-forum.com/t/how-to-check-type-of-ajax-response/176203/1 "2009-09-26T11:30:22Z")

</div>

Hello,  
When my post message is successfully saved I am returning simple  
message via:

flash[:notice] = “OK”

and when there are some errors due to validation I return the message  
in similar way:

flash[:notice] = form.errors.to\_xml()

then the message is sent via ajax:

respond\_to do |format|  
format.html { redirect\_to :back }  
format.js

How can I check on the client side which message was sent before  
displaying it?  
I am using jQuery.  
Thanks,  
bogumbiker
