jQuery Ajax error handling, show custom exception messages

Is there some way I can show custom exception messages as an alert in my jQuery AJAX error message? For example, if I want to throw an exception on the server side via Struts by throw new ApplicationException(“User name already exists”);, I want to catch this message (‘user name already exists’) in the jQuery AJAX … Read more

How do you select a particular option in a SELECT element in jQuery?

If you know the Index, Value or Text. also if you don’t have an ID for a direct reference. This, this and this are all helpful answers. Example markup <div class=”selDiv”> <select class=”opts”> <option selected value=”DEFAULT”>Default</option> <option value=”SEL1″>Selection 1</option> <option value=”SEL2″>Selection 2</option> </select> </div> 2Best Answer 21 A selector to get the middle option-element by … Read more

How to remove close button on the jQuery UI dialog?

How do I remove the close button (the X in the top-right corner) on a dialog box created by jQuery UI? 25 s 25 I have found this worked in the end (note the third line overriding the open function which find the button and hides it): $(“#div2”).dialog({ closeOnEscape: false, open: function(event, ui) { $(“.ui-dialog-titlebar-close”, … Read more

Best way to use Google’s hosted jQuery, but fall back to my hosted library on Google fail

What would be a good way to attempt to load the hosted jQuery at Google (or other Google hosted libs), but load my copy of jQuery if the Google attempt fails? I’m not saying Google is flaky. There are cases where the Google copy is blocked (apparently in Iran, for instance). Would I set up … Read more

Use jQuery to hide a DIV when the user clicks outside of it

I am using this code: $(‘body’).click(function() { $(‘.form_wrapper’).hide(); }); $(‘.form_wrapper’).click(function(event){ event.stopPropagation(); }); And this HTML: <div class=”form_wrapper”> <a class=”agree” href=”https://stackoverflow.com/questions/1403615/javascript:;”>I Agree</a> <a class=”disagree” href=”https://stackoverflow.com/questions/1403615/javascript:;”>Disagree</a> </div> The problem is that I have links inside the div and when they no longer work when clicked. 37 s 37