[jQuery] Re: $.ajax call doesn't complete on 400 bad request response
I see now I misunderstood the complete functionality of "JSONP", no XMLHttpRequest is made at all, and as a result it's not possible to control HTTP headers. In my case a script like: http://localhost:9998/search/jonas</a>? callback=jsonp1263842210822 "> is injected and and loaded by the browser. Is there a way to check whether this is loaded at all? I guess the browser will not evaluate it if the server returns an error-code. As far as I can see an $.ajax( call which uses JSONP functionality will never call the error function. This would mean that the option to use would be to implement custom error handling at the service with messages and HTTP status code 200. -- Anton On Jan 18, 8:26 pm, anton wrote: > A type, sorry, everything works fine without javascript warnings or > errors, can seem to get any function to be called after a request > which return 400. > > Just fixed the server so that it returns correct MIME-type > "application/javascript" instead of just text for errors, this wasn't > the problem though... > > $.ajax({ > url: "http://localhost:9998/search/"; + searchVal + "? > callback=?", > type: "GET", > dataType: "json", > success: function() { > alert("success"); > }, > error: function() { > alert("error"); > }, > complete: function() { > alert("complete"); > } > }); > > Some Firebug info after a call: > === > GEThttp://localhost:9998/search/jonas?callback=jsonp1263842210822400 > Bad Request localhost:9998 > Response Headers: > Server grizzly/1.9.9 > Content-Type application/javascript > Transfer-Encoding chunked > Date Mon, 18 Jan 2010 19:17:15 GMT > Connection close > > Response = jsonp1263842210822({"msg":"[LDAP: error code 4 - Sizelimit > Exceeded]"}) > > > I also find it strange that request is made with Accept Header = */* > instead of "application/json" which is stated as dataType but should > maybe be discussed in another topic... > > have tried using dataType : "jsonp" and skipped the callback info in > url, this gives the exact same result though. > > On Jan 18, 7:09 pm, Nathan Klatt wrote: > > > On Mon, Jan 18, 2010 at 11:05 AM, anton wrote: > > > Can't seem to get any response from an ajax call which response is 400 > > > Bad Request > > > > $.ajax({ > > > url: url > > > type: "GET", > > > Hey, is that missing comma after url a typo? > > > Nathan
[jQuery] Re: $.ajax call doesn't complete on 400 bad request response
A type, sorry, everything works fine without javascript warnings or errors, can seem to get any function to be called after a request which return 400. Just fixed the server so that it returns correct MIME-type "application/javascript" instead of just text for errors, this wasn't the problem though... $.ajax({ url: "http://localhost:9998/search/"; + searchVal + "? callback=?", type: "GET", dataType: "json", success: function() { alert("success"); }, error: function() { alert("error"); }, complete: function() { alert("complete"); } }); Some Firebug info after a call: === GET http://localhost:9998/search/jonas?callback=jsonp1263842210822 400 Bad Request localhost:9998 Response Headers: Server grizzly/1.9.9 Content-Typeapplication/javascript Transfer-Encoding chunked DateMon, 18 Jan 2010 19:17:15 GMT Connection close Response = jsonp1263842210822({"msg":"[LDAP: error code 4 - Sizelimit Exceeded]"}) I also find it strange that request is made with Accept Header = */* instead of "application/json" which is stated as dataType but should maybe be discussed in another topic... have tried using dataType : "jsonp" and skipped the callback info in url, this gives the exact same result though. On Jan 18, 7:09 pm, Nathan Klatt wrote: > On Mon, Jan 18, 2010 at 11:05 AM, anton wrote: > > Can't seem to get any response from an ajax call which response is 400 > > Bad Request > > > $.ajax({ > > url: url > > type: "GET", > > Hey, is that missing comma after url a typo? > > Nathan
[jQuery] Re: $.ajax call doesn't complete on 400 bad request response
success function is not called at all when I receiver error code 400: success: function() { alert("success"); }, error: function() { alert("error"); }, complete: function() { alert("complete"); } None of those are called, and I don't get javascript errors in console... On Jan 18, 6:23 pm, Nathan Klatt wrote: > On Mon, Jan 18, 2010 at 11:05 AM, anton wrote: > > Can't seem to get any response from an ajax call which response is 400 > > Bad Request > > > $.ajax({ > > url: url > > type: "GET", > > dataType: "json", > > success: aj.dataLoaded, > > error: function() { > > alert("error"); > > }, > > complete: function() { > > alert("complete"); > > } > > }); > > > When server responds with error code 400 neither the error function > > nor the complete function is called, any tips on how to correct this? > > What is aj.dataLoaded doing? I believe a 400 will go to the success > callback; after that finishes (assuming it does so :) it should call > the complete callback. Can the call to complete be disabled by > returning false from the success/error callback? > > Nathan
[jQuery] $.ajax call doesn't complete on 400 bad request response
Can't seem to get any response from an ajax call which response is 400 Bad Request $.ajax({ url: url type: "GET", dataType: "json", success: aj.dataLoaded, error: function() { alert("error"); }, complete: function() { alert("complete"); } }); When server responds with error code 400 neither the error function nor the complete function is called, any tips on how to correct this? Could there be a problem with parsing output, since this particular response also gives an error message in "text/plain" not JSON? Have tried with both processData set to false and true but with the same problem... Have tried both jQuery 1.3 and 1.4 -- Anton
[jQuery] Re: selection by XPath
version of jquery is 1.3.2
[jQuery] selection by XPath
hello all. I need some help in understanding XPath selection in JQuery: i.e. i have this html code: function f() { alert($('//body/div')); } aa after loading this page, firebug throws: exception uncaught exception: Syntax error, unrecognized expression: // body/div when i changed selector syntax to $("//body/div[id='1']") it returnes div with id 1 i'll be appreciate for any help! thnx
[jQuery] Re: $.ajax POST on ff3.5 and Chrome
So, i've figured out why that happens: in case of ff and chrome that is just some security policy, which forbids to do post on "remote host". Solution is quite simple - place controller and hmtl page with your scripts on same host, and after that parameter "url" in $.ajax post will transformed to url: "/api?callback=?&_=?" instead of http://localhost:9090/api...
[jQuery] $.ajax POST on ff3.5 and Chrome
good day guys! i have next code in my js-script: $.ajax({ url: 'http://localhost:9090/api?callback=?&_=?', type: 'post', dataType: 'json', data: {"sites" :$.toJSON(in_res), "out_res_http": $.toJSON(out_res_http), "out_res_http_www": $.toJSON (out_res_http_www), "out_res": $.toJSON(out_res)}, success: function(data) { alert(data.success); }, error: function(data){ alert ('error!' + " " +data); } }); as you see it tries to do post request to my server with some python controller on it, function works proper way on Safari (one of the latest versions) and in IE8, but in ff and chrome, browser sends OPTIONS request. Yeap. i've googled a lot on this issue, but i couldn't get any clearness for me. thanks for any of your opinions
[jQuery] Re: live event doesn't work after append()
> confusing test. You are reloading page into itself. Yes, what's wrong? > Clicking on links keeps working so not sure how this demonstrates how live() > not working I'm using firefox 3 (not tested in other browsers). So try do the following steps in firefox: 1. Open http://bestyle.org/jquery-live-test/ (or press F5 if already opened). Status text (yellow) must be "Page loaded WITHOUT ajax". 2. Click any link. Page will be updated, time changed. Status text must be "Page loaded via AJAX". 3. Ok. Now click any link once more. Page will be reloaded. Status text must be "Page loaded WITHOUT ajax". If live() works correctly then we can't be on the third step, because every click must lead the same result as on second step. But in our case live() works just like bind() i.e. it not sets up the handler on ajax-loaded content.
[jQuery] Re: live event doesn't work after append()
> Can you give us an online sample of it? Ok, I made a test-case: http://bestyle.org/jquery-live-test/ This is small html page, generated in php. Source code in http://bestyle.org/jquery-live-test/index.txt When you first time clicking the link, it will reload content via ajax. Second click is not handled by live() any more, and it will reload page without ajax. I think the problem core is that append() receive xml object, not html.
[jQuery] Re: live event doesn't work after append()
bind() is less convenient then live(), it's like 'custom way', but, yes, I'll use bind() too if I not find good solution with live(). On 30 июн, 12:38, waseem sabjee wrote: > I would suggest using.bind() > in my experience .live() is not very IE friendly > > On Tue, Jun 30, 2009 at 10:36 AM, Anton wrote: > > > Mean Mike, I did wrote you answer but it was not posted for some > > reason. > > That selector means that it will select all with no onclick > > attribute associated. > > So I try to 'ajaxify' all links on a page with my own handler. This > > handler will load page via $.ajax, extract part of it by specified id > > and then replace existed part with newly loaded one. > > > > Can you give us an online sample of it? > > I can't yet demonstrate it yet because it's on my internal server, but > > I'll try to make a test-case version. > > > > Is your page in quirks mode? > > Maybe, I don't know exactly how to determine it. > > > > Should work, see this example:http://jquery.nodnod.net/cases/444 > > This example is not using $.ajax(...).responseXML, so, yes, it's > > works. I tried to serialize loaded document to xml before calling > > append() and it was working too, but this way is very inefficient and > > not always working correctly. But when I using raw responseXML then > > live() begin behave just like bind().
[jQuery] Re: live event doesn't work after append()
Mean Mike, I did wrote you answer but it was not posted for some reason. That selector means that it will select all with no onclick attribute associated. So I try to 'ajaxify' all links on a page with my own handler. This handler will load page via $.ajax, extract part of it by specified id and then replace existed part with newly loaded one. > Can you give us an online sample of it? I can't yet demonstrate it yet because it's on my internal server, but I'll try to make a test-case version. > Is your page in quirks mode? Maybe, I don't know exactly how to determine it. > Should work, see this example: http://jquery.nodnod.net/cases/444 This example is not using $.ajax(...).responseXML, so, yes, it's works. I tried to serialize loaded document to xml before calling append() and it was working too, but this way is very inefficient and not always working correctly. But when I using raw responseXML then live() begin behave just like bind().
[jQuery] live event doesn't work after append()
I found the bug ticket with similar problem: http://dev.jquery.com/ticket/4762, but it was closed as invalid. The problem still exists for me. I have the following live event: $("a:not([onclick])").live('click', ajaxLinkHandler); It's not applying to content loaded via $.ajax(...).responseXML which I used to append in the following way: // withing ajaxLinkHandler var content = $(loadedDocument).find("[component='"+ id +"']"); $(this.contentContainer).empty().append(content);
[jQuery] .slideUp .slideDown issues in IE
I have been asked to build this slide up and down functionality on http://iuvodesign.com/ landing page. If you go to the address underneath the large image you will see Recent and Selected works. It seems to be working fine in all browsers, but IE displays the contents as soon as I click on the header and then things slide down over the contents. I have overflow:hidden applied. Does anyone know how I could fix this IE issue? Thanks!
[jQuery] Re: onclick change class to new class
You should be attaching your click bind to the anchor element not the list element, since thats whats going to be firing the event. On Oct 30, 1:18 pm, Info <[EMAIL PROTECTED]> wrote: > Hello All, > I have a CSS list that I use as my navigation. Each LI has a > background image as the base and a a:hover image for roll over. Within > the LI item for the navaigation I have a ahref that is used to fire > off some jquery function. All this worksnow I want to change the > LI item to another css class if it clicked. I have tried this: > > $('#gt').click(function() { > $(this).removeClass("gt"); > $(this).addClass("gt_active"); > }); > > But that doesn't work :-( > > Here is a sample of the complete code: > > HTML > > > li> > li> > li> > > > > CSS: > > #main_container #left_container .mid_outer .slide_outer .order_menu > li.gt a{float:left; width:235px; height:54px; background:url(../images/ > gt.jpg) no-repeat top left;} > > #main_container #left_container .mid_outer .slide_outer .order_menu > li.gt a:hover{background:url(../images/gt_over.jpg) no-repeat top > left;} > > #main_container #left_container .mid_outer .slide_outer .order_menu > li.gt_active{float:left; width:235px; height:54px; background:url(../ > images/gt_over.jpg) no-repeat top left;} > > Any help would be great!
[jQuery] Re: [autocomplete] tab issue with autcomplete plugin
I too can't keep focus on the autocomplete field after hitting the tab key in Firefox (Safari works fine - it stays in the field). I'm running the latest version (1.0.2) as well. Let me know if there's some way I can help bugtracking this. cheers, /Anton On 18 Juni, 22:15, Carl Von Stetten <[EMAIL PROTECTED]> wrote: > Jörn, > > I have made extensive use of the autocomplete plugin for my intranet > site. I just downloaded the updated version from the trunk (changelog > shows it as 1.0.1, the js file lists the build as 5329). I still have > the tab order problem. > > Carl > > Jörn Zaefferer wrote: > > Yes, that should be fixed in the latest revision: > >http://dev.jquery.com/view/trunk/plugins/autocomplete/ > > > Can you assert that it actually fixes the issue? I'll create a new > > release, then. > > > On Fri, Jun 13, 2008 at 7:53 PM, Priest, James (NIH/NIEHS) [C] > > <[EMAIL PROTECTED]> wrote: > > >> Jörn, have you made any progress on the TAB issue with the Autocomplete > >> plugin? > > >> ie: If you in that field and tab away - you loose your tab order. I know > >> it came up in the comments on the plugin page but I haven't heard any more > >> updates on it... > > >> Thanks, > >> Jim
[jQuery] Re: Select multiple elements with "almost" same id
Hi Zlocho, Couldn't you do something like $("input[name^='quantity']") here? They seem to share the same name. cheers, /Anton On 17 Apr, 18:30, Zlochko <[EMAIL PROTECTED]> wrote: > Hallo everyone. My name is Gjoko Pargo. I am a new member of this > group, in fact - this is my first message here. I work mainly as a web > applications developer and have extensive experience in php, asp, > coldfusion, javascript and several types of databases. > Although I do have some pretty good experience in JavaScript I still > can't seem to get the grasp of some of the jQuery concepts. So I have > two pretty basic questions which I was not able to find answers for. > > 1. In one of my projects, I am building a shopping cart. The product > list quantity fields are made of input fields with id's consisted of a > reserved word and product_id combination. They look something like > this: > > > For those with web application experience the name quantity with it's > two square brackets gives the browser the ability to make a list of > each entry in one associative array and send it to the browser on > submit. > > My problem is - I need to select all of the form elements which have > "quantity[something]" in their id and then apply some action to them. > Could anyone please help me on how to achieve this? Is this done with > regular expressions or is there some "native" jQuery way to do this? > > 2. On the same page where the product list is, there is also a > shopping basket. What happens is that after the visitor populates the > quantities of the desired products he/she hits on the submit button, > and if everything is ok, the data is transfered to the server over > ajax submit and then the contents of the shopping basket is changed in > real time. Everything works ok, but I would like to add some eye > candy... > Namely, after submit, I want to fadeOut the shopping basket (or a > specific element), and then do a fedeIn to make the shopping basket > visible again with the new value. I was able to succeed in this, but > unfortunately the fedeOut, changeOfQuantityValue and fadeIn are not > synchronized. This means that depending on the speed of the connection > the list starts to fade out, changes the item list values (while still > visible), and then fades back in... or for slower connections: it > fades out, fades in and then change the item list values. > Any help with this? > > Thank you very much, > Gjoko Pargo.
[jQuery] interface.eyecon.ro price slider questions
Hi, I'm talking about http://interface.eyecon.ro/demos/slider_minmax.html I'm trying to create a more usable version of the slider: The slider gets information about price from my script, so I need to pass two numbers (e.g. $20 -500 - it means that indicators should take there positions approx in the center of the bar) The slider has method for setting indicator positions, but SliderSetValues() accepts strange int numbers, really. E.g. if you call SliderSetValues with [[ -40, 0]] it is approximately the bar start. I've looked through the source code, the author uses jQuery.iSlider.dragmoveBy(this.dragElem, [-2000, -2000] ); if he need to put the indicator at the beginning of the slider bar (actually [-1000, -1000] do the same thing ) - does it mean that there is no way to get the exact address of the beginning or of the middle (or 33%) of the slider to put inidcator there programmatically? Thanks in advance, guys.
[jQuery] Re: Problem with ClueTip: Flash-Elements flickers when rollover (SOLVED!)
Just a quick update to let you know I solved my problem. In fact it turned out to be quite simple. As soon as I added position:relative to the element I was appending the cluetip to, the style="position:static" thingie went away, the DOM stayed unmodified and the bug disappeard. Sorry if this was mentioned earlier or in the documentation somewhere, I just thought I'd let you know my story. cheers again, /Anton
[jQuery] Re: Problem with ClueTip: Flash-Elements flickers when rollover
> While I think it's a Firefox bug, the most recent version of clueTip > lets you work around it: While I very much appreciate the additions, they don't fix the problem with style="position:static" getting added to a parent of the Flash file (thus triggering the bug). Why is this? Is the script checking for position:relative (of which I have many) and resetting this to static? If so, is this avoidable somehow? cheers, /Anton
[jQuery] Re: jCarousel Lite - version 1.0
> Anton - As per your request, the buttons will be assigned a class called > "disabled" when the carousel is in the first or last element respectively. > This is applicable to non-circular carousels only. Great, although that's not what I meant :) However, I solved my issue using (shortened, for brevity): if(jQuery(".jcarousel ul").children().length > 12) { jQuery(".jcarousel").before('Previous').after('Next'); } But the "disabled" comes very handy too, thanks! cheers, /Anton
[jQuery] Re: Problem with ClueTip: Flash-Elements flickers when rollover
> > no flicker with wrapper-div: > >http://www.media-giganten.de/test/cluetip-test/index.html > > > flicker without div and changed fx: > >http://www.media-giganten.de/test/cluetip-test/index_flick.html Is this a Firefox bug, not a Cluetip bug? I so wish this issue could be solved somehow.. PS. I noticed in Firebug that the two example pages differ from each other in that body gets style="position:static" when hovering, is that relevant to the problem? Maybe it treats the DOM as "fresh", thus reloading the Flash? Just a long shot.. Thanks in advance, /Anton
[jQuery] Re: jCarouselLite - my first plugin - anxiously awaiting comments
Love it! But... > << > >> Is there any way you could determine if the number of items equals the setting in "visible"? I'd like to hide these buttons if I'm already viewing all of the items. cheers, /Anton