Re: [jQuery] Delaying Click Event
The simplest way to do this is to use the setTimeout method (straight JS) and give it an anonymous function as callback to trigger after given period. Something like this should do the trick : $('a.delayed').click(function() { // assuming these links all share the "delayed" class var clicked = $(this); // when setTimeout calls your anonymous function, "this" will point to something else entirely setTimeout(function () { window.location.href = clicked.attr('href'); // assuming you want to go wherever the link points to }, 1000); return false; // to prevent default action to be immediately triggered }); Hope it helps. Michel Belleville 2010/1/4 david.vansc...@gmail.com : > I've been searching high and low on Google over the last hour looking > for this, but can't seem to find anything. Maybe I'm using the wrong > search terms, but I'd think what I'm trying to accomplish is something > that's been done before. > > What I'm looking to do is delay the action of a click for a set period > of time. I have a list of links for download zip archives and when > you click on one of those links, I use the BlockUI plugin to show an > overlay with a message that tells the user their download will start > momentarily. The reason this is done is so that I can fire off an > AJAX event that inserts a record into a database for download > tracking. Ideally what I'd like to do is fire the AJAX event (which > should only take about .2 seconds to run) and then wait for 2 or 3 > seconds before unblocking the UI and *then* letting the default action > of the click (offering up the zip archive) fire. > > Any ideas how I might accomplish something like this? >
Re: [jQuery] JQuery ajaxSend/ajaxComplete
Something like this perhaps ? http://docs.jquery.com/UI/Dialog Michel Belleville 2009/12/29 Westside : > Hi, > > I'm using this code to display an image when an ajax requests happen > in my app: > > $("#ajax_loading_div") > .bind("ajaxSend", function(){ > $(this).show(); > }) > .bind("ajaxComplete", function(){ > $(this).hide(); > }); > > The problem is I'd like to have the div centered in the middle of the > screen and have the window be modal so the user can't interact with it > during my ajax request. > > How can I do that hopefully building on the above code snippet? > > thx > > -westside >
Re: [jQuery] Re: Multiple responses from a single Ajax call
Are you returning precisely this : ... ... ... Or is there a wrapper around these divs like : ... ... ... Because I think I remember jQuery doesn't like to fumble around raw xml without a root element to wrap around it. Michel Belleville 2009/12/9 kingunderscore > ok i'm failing, even the piggies aren't helping. > > ok this is the structure of what is coming back from my call. > > > ... > > > . > > > . > > > so this is what i am doing... > success: function(htmlReturn){ >mainData = $j('#top', htmlReturn).html(); >topData = $j('#middle', htmlReturn).html(); >leftData = $j('#bottom', htmlReturn).html(); > >$j("#appliedFilters").html(topData); >$j("#notAppliedFilters").html(leftData); >$j("#searchResults").html(mainData); > } > > What am i doing wrong? The selectors i am using to populate the > variables keep returning nothing, i have to have the syntax wrong. > > Any help is appreciated^2 > > On Dec 9, 1:01 pm, Michel Belleville > wrote: > > Well obvisouly you've got it all now. > > > > Always a pleasure ^^ > > > > Michel Belleville > > > > 2009/12/9 kingunderscore > > > > > Hmm ok. > > > > > So i what i am getting from this is that i can refer to elements > > > inside of the response object. > > > > > $('#cold room').html($('house.of_bricks', piggies).html()); > > > > > So in my case if i call my file and build 3 different divs inside of > > > the html output I can then take the innerHTML from each of the > > > response divs and populate the divs that i have on the page. > > > > > I think i got it. I will let you know if it works out. > > > > > thanks a lot for your piggy example :) > > > > > On Dec 9, 12:38 pm, Michel Belleville > > > wrote: > > > > Well, if you want to load 3 different bits of data to put in 3 > different > > > > places all at once, first you've got to get your server to return the > 3 > > > > little bits of datas in only one query and wrap them in containers so > you > > > > recognize them. So let's assume your unique query returns its results > > > this > > > > way : > > > > > > > > > > a little piggy > > > > another little piggy > > > > this clever little bastard piggy > > > > > > > > > > Now let's bring them where they belong. > > > > > > $.ajax({ > > > > url: '/come_to_me_little_piggies.asp', > > > > data: { or_i_will: 'huff', and: 'puff' }, > > > > cache: false, > > > > success: function(piggies) { > > > > // I'm real hungry, so the first one will end up in my stomach > > > > $('#my_stomach').html($('house.of_straw', piggies).html()); > > > > > > // now I'm not so hungry so the second little piggy I'll keep for > > > tomorrow > > > > $('#leftovers').html($('house.of_wood', piggies).html()); > > > > > > // seems like this house of bricks was no match for mr wolf after > all, > > > let's > > > > put little smartass in the cold room > > > > $('#cold room').html($('house.of_bricks', piggies).html()); > > > > > > } > > > > }); > > > > > > But the important thing is if you don't want to do 3 queries, you've > got > > > to > > > > return all data in just one query. > > > > > > Michel Belleville > > > > > > 2009/12/9 kingunderscore > > > > > > > First of all i am working in ASP. And i have 3 elements i am > trying > > > > > to populate. I can do that no problem, but my issue is I am > basically > > > > > making the same Ajax request 3 times and there is SQL involved that > i > > > > > would rather only make once. > > > > > > > I have pseudo code below to represent what i am doing. If i could > > > > > just make one call and pull topData, LeftData, and gridData that > would > > > > > cut the processing down significantly. > > > > > > > $j.ajax({ > > > > > url: '/ajaxHandler.asp', > > > > >
Re: [jQuery] Re: Multiple responses from a single Ajax call
Well obvisouly you've got it all now. Always a pleasure ^^ Michel Belleville 2009/12/9 kingunderscore > Hmm ok. > > So i what i am getting from this is that i can refer to elements > inside of the response object. > > $('#cold room').html($('house.of_bricks', piggies).html()); > > So in my case if i call my file and build 3 different divs inside of > the html output I can then take the innerHTML from each of the > response divs and populate the divs that i have on the page. > > I think i got it. I will let you know if it works out. > > thanks a lot for your piggy example :) > > On Dec 9, 12:38 pm, Michel Belleville > wrote: > > Well, if you want to load 3 different bits of data to put in 3 different > > places all at once, first you've got to get your server to return the 3 > > little bits of datas in only one query and wrap them in containers so you > > recognize them. So let's assume your unique query returns its results > this > > way : > > > > > > a little piggy > > another little piggy > > this clever little bastard piggy > > > > > > Now let's bring them where they belong. > > > > $.ajax({ > > url: '/come_to_me_little_piggies.asp', > > data: { or_i_will: 'huff', and: 'puff' }, > > cache: false, > > success: function(piggies) { > > // I'm real hungry, so the first one will end up in my stomach > > $('#my_stomach').html($('house.of_straw', piggies).html()); > > > > // now I'm not so hungry so the second little piggy I'll keep for > tomorrow > > $('#leftovers').html($('house.of_wood', piggies).html()); > > > > // seems like this house of bricks was no match for mr wolf after all, > let's > > put little smartass in the cold room > > $('#cold room').html($('house.of_bricks', piggies).html()); > > > > } > > }); > > > > But the important thing is if you don't want to do 3 queries, you've got > to > > return all data in just one query. > > > > Michel Belleville > > > > 2009/12/9 kingunderscore > > > > > First of all i am working in ASP. And i have 3 elements i am trying > > > to populate. I can do that no problem, but my issue is I am basically > > > making the same Ajax request 3 times and there is SQL involved that i > > > would rather only make once. > > > > > I have pseudo code below to represent what i am doing. If i could > > > just make one call and pull topData, LeftData, and gridData that would > > > cut the processing down significantly. > > > > > $j.ajax({ > > > url: '/ajaxHandler.asp', > > > data: {handleSection:["top"],searchTerm:[''+searchTerm]}, > > > cache: false, > > > complete: function(){ > > > $j.ajax({ > > > url: '/ajaxHandler.asp', > > > data: > > > {handleSection:["left"],searchTerm:[''+searchTerm]}, > > > cache: false, > > > beforeSend: function(){ > > > }, > > > complete: function(){ > > > }, > > > success: function(html){ > > > leftData = html; > > > > > $j.ajax({ > > > url: '/ajaxHandler.asp', > > > data: > > > {handleSection:["grid"],searchTerm:[''+searchTerm]}, > > > cache: false, > > > beforeSend: function(){}, > > > complete: function(){ > > > }, > > > success: function(html){ > > >gridData = html; > > > > > // populate sections > > > $j("#top").html(topData); > > > $j("#left").html(leftData); > > > $j("#grid").html(gridData); > > > } > > >}); > > > } > > >}); > > > }, > > > success: function(html){ > > >topData = html; > > > } > > >}); >
Re: [jQuery] Multiple responses from a single Ajax call
Well, if you want to load 3 different bits of data to put in 3 different places all at once, first you've got to get your server to return the 3 little bits of datas in only one query and wrap them in containers so you recognize them. So let's assume your unique query returns its results this way : a little piggy another little piggy this clever little bastard piggy Now let's bring them where they belong. $.ajax({ url: '/come_to_me_little_piggies.asp', data: { or_i_will: 'huff', and: 'puff' }, cache: false, success: function(piggies) { // I'm real hungry, so the first one will end up in my stomach $('#my_stomach').html($('house.of_straw', piggies).html()); // now I'm not so hungry so the second little piggy I'll keep for tomorrow $('#leftovers').html($('house.of_wood', piggies).html()); // seems like this house of bricks was no match for mr wolf after all, let's put little smartass in the cold room $('#cold room').html($('house.of_bricks', piggies).html()); } }); But the important thing is if you don't want to do 3 queries, you've got to return all data in just one query. Michel Belleville 2009/12/9 kingunderscore > First of all i am working in ASP. And i have 3 elements i am trying > to populate. I can do that no problem, but my issue is I am basically > making the same Ajax request 3 times and there is SQL involved that i > would rather only make once. > > I have pseudo code below to represent what i am doing. If i could > just make one call and pull topData, LeftData, and gridData that would > cut the processing down significantly. > > $j.ajax({ > url: '/ajaxHandler.asp', > data: {handleSection:["top"],searchTerm:[''+searchTerm]}, > cache: false, > complete: function(){ > $j.ajax({ > url: '/ajaxHandler.asp', > data: > {handleSection:["left"],searchTerm:[''+searchTerm]}, > cache: false, > beforeSend: function(){ > }, > complete: function(){ > }, > success: function(html){ > leftData = html; > > $j.ajax({ > url: '/ajaxHandler.asp', > data: > {handleSection:["grid"],searchTerm:[''+searchTerm]}, > cache: false, > beforeSend: function(){}, > complete: function(){ > }, > success: function(html){ >gridData = html; > > // populate sections > $j("#top").html(topData); > $j("#left").html(leftData); > $j("#grid").html(gridData); > } >}); > } >}); > }, > success: function(html){ >topData = html; > } >}); >
Re: [jQuery] Replacing brs in a div
Regexp seems indeed the simplest way to acheive it. Something like this might just work : whatever_string.replace(/<(\/?)\s*br>/gi, "\r\n") Michel Belleville 2009/12/9 Mad-Halfling > Hi, this seems like a stupid question, but I'm not quite sure if I can > do it or not. I am copying the contents of a div into a textarea like > this:- > $('#TextAreaID').append($('#DivID').html()); > and it works ok, but I need to replace any tags in the divs > content with \r\n - can I do this with replaceAll or replaceWith or do > I need to use regexs? > > Sorry for such a silly question, but I can't quite get my head around > how to use those methods and if I can use them on plain text as they > seem to either run on the whole doc or (if used in an element's > function) "this". >
Re: [jQuery] onclick send parameter to a JQuery function?
I fail to see where your problem was related to your question ; anyway, what I just explained will work with AJAX (that was even the point really), you just have to add the .load() or the .get() and give them the appropriate parameters to have a nice and shiny ajax interface for your users to enjoy. Michel Belleville 2009/12/8 Themba Ntleki > Thanks Michel, > > I found a solution, my mistake was trying to create the function inside : > $(document).ready(function() { > > the onClick could not find the function. I have defined the function > separately and the onclick does work. Basically, I want to do the edit > action using ajax, but thanks a mil for the response!! > > > > 2009/12/8 Michel Belleville > > First of all you'll need to write your $ec_arr[4] somewhere in your page, >> or your client-side jQuery script won't be able to even guess it. Ideally it >> should be placed as near as possible from your edit link. Wait, what's a >> link for ? Bringing the client to another url, the href attribute exists for >> this very purpose. And we want to pass an argument / parameter when we click >> on that link... Hey, why not put it right on the href attribute then ? >> >> Edit >> >> Hmm, something seems a bit out of place. I mean, unless whatever is in >> $ec_arr[4] is an actual url, it's not quite proper to put just this in a >> link's href right ? Right. So, let's assume you've got an edit script >> located there : "http://somewhere.over.therainbow.com/way/up_high.php";, >> which takes "id" as a parameter, and that this id is what's in $ec_arr[4] : >> >> http://somewhere.over.therainbow.com/way/up_high.php?id=> echo $ec_arr[4] ?>">Edit >> >> This way, even when your user wouldn't have JavaScript, this is still >> working for him if a bit less friendly. Now how do I easily set up a click >> callback on each link of a table ? >> >> $('table a').click(function() { alert('OMG someone clicked me !'); }); >> >> And how do we get the clicked element in a click callback ? >> >> $('table a').click(function() { alert('OMG someone clicked me again ! And >> I totally have this href thingy : ' + $(this).attr('href')); }); >> >> Now I'll let you figure out how to put all this together with whatever >> .load() or .get() or something else you'd like to do to get your form back >> on your page. >> >> Michel Belleville >> >> >> 2009/12/8 theUnseen >> >> Hi guys, >>> >>> I show a table with mysql data with an edit option/link for each >>> record, but i want the edit link to call a jquery function onclick and >>> it must pass the $ec_arr[4] as the argument/parameter which is the id >>> of the record in the mysql table to JQuery. how can I do this >>> please...? >>> >>> >>> >>> Fullname >>> Relationship >>> Contact number >>> Residential address >>> >>> >>> >>> >>> >>> >>> >>> >>> Edit >>> >>> >>> >>> >> >> > > > > > > > >
Re: [jQuery] onclick send parameter to a JQuery function?
First of all you'll need to write your $ec_arr[4] somewhere in your page, or your client-side jQuery script won't be able to even guess it. Ideally it should be placed as near as possible from your edit link. Wait, what's a link for ? Bringing the client to another url, the href attribute exists for this very purpose. And we want to pass an argument / parameter when we click on that link... Hey, why not put it right on the href attribute then ? Edit Hmm, something seems a bit out of place. I mean, unless whatever is in $ec_arr[4] is an actual url, it's not quite proper to put just this in a link's href right ? Right. So, let's assume you've got an edit script located there : "http://somewhere.over.therainbow.com/way/up_high.php";, which takes "id" as a parameter, and that this id is what's in $ec_arr[4] : http://somewhere.over.therainbow.com/way/up_high.php?id=">Edit This way, even when your user wouldn't have JavaScript, this is still working for him if a bit less friendly. Now how do I easily set up a click callback on each link of a table ? $('table a').click(function() { alert('OMG someone clicked me !'); }); And how do we get the clicked element in a click callback ? $('table a').click(function() { alert('OMG someone clicked me again ! And I totally have this href thingy : ' + $(this).attr('href')); }); Now I'll let you figure out how to put all this together with whatever .load() or .get() or something else you'd like to do to get your form back on your page. Michel Belleville 2009/12/8 theUnseen > Hi guys, > > I show a table with mysql data with an edit option/link for each > record, but i want the edit link to call a jquery function onclick and > it must pass the $ec_arr[4] as the argument/parameter which is the id > of the record in the mysql table to JQuery. how can I do this > please...? > > > > Fullname > Relationship > Contact number > Residential address > > > > > > > > > Edit > > > >
Re: [jQuery] Re: next()
Well it would work if a bit complicated and probably a pain to maintain. If there wouldn't be any other select named like your second select, I'd rather select it by its name if I were you. Or perhaps give these specific select a common ancestor and select it using this common ancestor as reference. Michel Belleville 2009/12/4 TMNT > Michel, thanks for your response. > So, do I need to get the parent of my country element (which would be > the div ) & get all it's siblings and then look for elements with > class 'state' or is there a simpler way? > > > On Dec 4, 12:47 am, Michel Belleville > wrote: > > That's easy, .next() finds the nearer next *sibling* of current element > > matching the selector. In your case, your element is not current > element's > > sibling, it's under another node altogether. > > > > > > hey, it's me !! > > and I'm his sibling > > and I am too > > > > though I am not because I'm not the direct child of the same direct > > parent > > > > > > > > neither am I, I'm also in another parent, the fact that I'm on the > same > > indentation level is not enough to make me directly related to this " > span.me" > > guy > > > > > > Hope it helps. > > > > Michel Belleville > > > > 2009/12/4 TMNT > > > > > Thank you jpcozart. here's part of my html: > > > > > > > > Country of ED Submitter > > class="form-required" title="This field is required.">*: > > label> > > > > > disabled="disabled" id="edit-question-900" >-- Select > > > country --Canada > > option>Kazakhstan > > value="1177">Russian Federation > > value="1191">SingaporeSlovenia > > option>South Africa > > value="1228">United States > > > > > > > > > State or Region of ED Submitter > > class="form-required" title="This field is required.">*: > > label> > > > > > disabled="disabled" id="edit-question-898" >-- Select > > > one --Alberta > > option>British Columbia > > value="1102">ManitobaNew Brunswick > > option>Newfoundland and Labrador > > value="1105">Northwest TerritoriesNova > > > ScotiaNunavut > > value="1108">OntarioPrince Edward > > > IslandQuebec > > value="">SaskatchewanYukon > > > Territory > > > > > > > > On Dec 3, 2:24 pm, jpcozart wrote: > > > > I would have to see the structure of the document to know where the > > > > problem lies. It seems as though > > > > > > country.next("select.state"); > > > > > > is not returning the node you are looking for. > > > > > > On Dec 3, 1:07 pm, TMNT wrote: > > > > > > > Matt, thanks for your response. > > > > > > > I had originally posted this on jquery-dev group but was referred > to > > > > > this group. > > > > > How do I access the id of the jquery object returned from the > next() > > > > > function? > > > > > I tried Matt's suggestion below but I get an 'undefined' when I > alert > > > > > state.attr('id'). > > > > > thank you. > > > > > > > From: Matt Maxwell > > > > > Date: Thu, 3 Dec 2009 05:28:48 -0600 > > > > > Local: Thurs, Dec 3 2009 3:28 am > > > > > Subject: Re: [jquery-dev] Re: next() > > > > > Reply | Reply to author | Forward | Print | Individual message | > Show > > > > > original | Report this message | Find messages by this author > > > > > > > I would do something like > > > > > > > $("select.country").change(function () { > > > > > var country = $(this), > > > > > country_id = country.attr("id"), > > > > > state = country.next("select.state"); > > > > > > > }); > > > > > > > state isn't the DOM element, it's the jQuery object, so you'd have > to > > > > > go > > > > > alert(state.attr("id")); > > > > > > > Hope this helps. > > > > > > > Also, I agree with Dave, this isn't the place for this kind of > > > > > question. > > > > > > > - Hide quoted text - > > > > > - Show quoted text - > > > > > On Wed, Dec 2, 2009 at 6:20 PM, Dave Methvin < > dave.meth...@gmail.com> > > > > > wrote: > > > > > > > > The jQuery-en group is a better fit for this question. This group > is > > > > > > for the discussion of the development of jQuery itself. > > > > > > -- >
Re: [jQuery] Re: Can I use "$(document).ready(function(){ " in the same page more than a once time in the same page
Basically, my advice would be : 1. first, load jQuery 2. then load jQuery extensions (UI, plugins) 3. then load your own domain-specific extensions (method declarations, etc.) 4. then load your page hooks (in a $(function() { ... }) block so it starts when the page is complete), preferably grouped by functionalities And it's usually better to write less code in 4. than in 3. (4. is preferably just for hooks). Michel Belleville 2009/12/4 coolf > ok, thanks for the response. > But what is the best, is it good to have more than a "documen.ready" ? > it doesn't bring problems? > > On 4 dic, 11:33, Andreas Möller wrote: > > > Hello i'm new here, Is it posible? > > > > Yes, it is. > > > > Best regards, > > > > Andreas >
Re: [jQuery] Is possible to update two div with the same load?
Well it depends ; most of the times you end up loading a big bit of data that should replace a specific portion of the screen (let the standard .load() behaviour do the heavy lifting for this one) plus a few tidbits like notifications and so on that are secondary (can be dealt with in the callback), so your code is just a little bit more expressive (the "main" purpose of the query is expressed first in the .load() mandatory parameters, then the "secondary" tidbits are placed later in the callback). Using .get() would also do the job, but would be slightly less readable later. Michel Belleville 2009/12/4 Richard D. Worth > I think you're better of with $.get and then doing the finding and loading > into both divs yourself. > > - Richard > > > On Fri, Dec 4, 2009 at 5:21 AM, NMarcu wrote: > >> Hi, >> >> I need to update a div that contain a table, and another one that >> contain a drop down list, that is build depending on what is in one >> table from db(the first div depend on this also). It's possible to >> update the 2 divs with the same load, or need to use two load. I try >> this but not worked correct. >> >> Thanks. >> > >
Re: [jQuery] Is possible to update two div with the same load?
For some reason I have a feeling you've overlooked the official jQuery documentation on .load(), especially the example section. http://docs.jquery.com/Ajax/load#urldatacallback Michel Belleville 2009/12/4 Nicu Marcu > Can you give me please some example or where to find a documentation about > what you said. > > 2009/12/4 Michel Belleville > > .load() also has a success triggered callback. >> >> Michel Belleville >> >> >> 2009/12/4 NMarcu >> >> Hi, >>> >>> I need to update a div that contain a table, and another one that >>> contain a drop down list, that is build depending on what is in one >>> table from db(the first div depend on this also). It's possible to >>> update the 2 divs with the same load, or need to use two load. I try >>> this but not worked correct. >>> >>> Thanks. >>> >> >> > > > -- > All the best, > > Nicolae MARCU >
Re: [jQuery] Is possible to update two div with the same load?
.load() also has a success triggered callback. Michel Belleville 2009/12/4 NMarcu > Hi, > > I need to update a div that contain a table, and another one that > contain a drop down list, that is build depending on what is in one > table from db(the first div depend on this also). It's possible to > update the 2 divs with the same load, or need to use two load. I try > this but not worked correct. > > Thanks. >
Re: [jQuery] Re: Why mootools animations is more smooth than jquery?
Just used your benchmark and I didn't see any significant differences. Both had slight jumps from time to time, none felt like there was a pattern, I'm using Firefox 3.5 on a iMac pro (last year's edition) running snow leopard. Michel Belleville 2009/12/4 Jonathan Vanherpe (T & T NV) > Karl Swedberg wrote: > > > On Dec 3, 2009, at 7:31 PM, Dave Methvin wrote: > > I refrained from replying because the OP seemed trollish, but he has a > > point, IMHO. > > > It would be great if someone who knew both frameworks could set up a > page that demonstrated a side-by-side case where Mootools has smoother > animations than jQuery. Otherwise it's hard do know what might be > causing the problem, or even whether there's a problem at all. > > > That's a great idea, Dave. > > I wonder how much the easing equation affects people's perception of > "smoothness." It might be worthwhile to try animations using the easing > plugin and see if any of those equations feel smoother. > > --Karl > > > Karl Swedberg > www.englishrules.com > www.learningjquery.com > > ok, I've used some code I had lying around and put dummy content in > there: > http://www.tnt.be/bugs/jquery/moovsjquery/ > > I actually don't really see a difference on my Ubuntu box (using FF 3.6b4), > but there's a huge difference on a colleague's G4 (OS X 10.4, Firefox > 3.5.5), so try to find a slow computer to test this on. > > Again, this might be the fault of the plugin I'm using, if you have another > way of doing the same thing in jQuery you can tell me so I know for next > time. I really prefer using jQuery, but sometimes I just can't because of > things like this. > > Jonathan > > -- > [image: www.tnt.be] <http://www.tnt.be/?source=emailsig> *Jonathan > Vanherpe* > jonat...@tnt.be - www.tnt.be <http://www.tnt.be/?source=emailsig> - tel.: > +32 (0)9 3860441 >
Re: [jQuery] Automagically link http(s)://, mailto: etc in String
Indeed, you could try something like this : string.replace(/((?:(?:http:\/\/)|(?:mailto:))([^\s]+))/, '$2'); And bam! the returned value will have your http://s and mailto:s wrapped in nice links. Michel Belleville 2009/12/4 Dhruva Sagar > Of course it's possible :). All you need to do is know a little bit of > regular expressions & that's pretty much it, you could use simple javascript > as well if you like. > > Thanks & Regards, > Dhruva Sagar. > > > > > > On Fri, Dec 4, 2009 at 6:09 AM, Scott Wilcox wrote: > >> Hello Folks, >> >> I'm usually pretty good at Googling and finding my own answers to >> problems, however this one has left me a little stumped. Is it >> possible either using JQuery, a plugin or standard JS to automagically >> create links for URI's within a string? >> >> I'm having a complete block trying to figure this out. >> >> Thanks for reading, >> >> Scott. >> > >
Re: [jQuery] Re: next()
That's easy, .next() finds the nearer next *sibling* of current element matching the selector. In your case, your element is not current element's sibling, it's under another node altogether. hey, it's me !! and I'm his sibling and I am too though I am not because I'm not the direct child of the same direct parent neither am I, I'm also in another parent, the fact that I'm on the same indentation level is not enough to make me directly related to this "span.me" guy Hope it helps. Michel Belleville 2009/12/4 TMNT > Thank you jpcozart. here's part of my html: > > > Country of ED Submitter class="form-required" title="This field is required.">*: label> > disabled="disabled" id="edit-question-900" >-- Select > country --Canada option>Kazakhstan value="1177">Russian Federation value="1191">SingaporeSlovenia option>South Africa value="1228">United States > > > State or Region of ED Submitter class="form-required" title="This field is required.">*: label> > disabled="disabled" id="edit-question-898" >-- Select > one --Alberta option>British Columbia value="1102">ManitobaNew Brunswick option>Newfoundland and Labrador value="1105">Northwest TerritoriesNova > ScotiaNunavut value="1108">OntarioPrince Edward > IslandQuebec value="">SaskatchewanYukon > Territory > > > > > On Dec 3, 2:24 pm, jpcozart wrote: > > I would have to see the structure of the document to know where the > > problem lies. It seems as though > > > > country.next("select.state"); > > > > is not returning the node you are looking for. > > > > On Dec 3, 1:07 pm, TMNT wrote: > > > > > Matt, thanks for your response. > > > > > I had originally posted this on jquery-dev group but was referred to > > > this group. > > > How do I access the id of the jquery object returned from the next() > > > function? > > > I tried Matt's suggestion below but I get an 'undefined' when I alert > > > state.attr('id'). > > > thank you. > > > > > From: Matt Maxwell > > > Date: Thu, 3 Dec 2009 05:28:48 -0600 > > > Local: Thurs, Dec 3 2009 3:28 am > > > Subject: Re: [jquery-dev] Re: next() > > > Reply | Reply to author | Forward | Print | Individual message | Show > > > original | Report this message | Find messages by this author > > > > > I would do something like > > > > > $("select.country").change(function () { > > > var country = $(this), > > > country_id = country.attr("id"), > > > state = country.next("select.state"); > > > > > }); > > > > > state isn't the DOM element, it's the jQuery object, so you'd have to > > > go > > > alert(state.attr("id")); > > > > > Hope this helps. > > > > > Also, I agree with Dave, this isn't the place for this kind of > > > question. > > > > > - Hide quoted text - > > > - Show quoted text - > > > On Wed, Dec 2, 2009 at 6:20 PM, Dave Methvin > > > wrote: > > > > > > The jQuery-en group is a better fit for this question. This group is > > > > for the discussion of the development of jQuery itself. > > > > -- >
Re: [jQuery] Re: Why mootools animations is more smooth than jquery?
I wonder, is this a feeble attempt at launching a troll, a poorly worded vague question, or just good old plain nonsense ? Michel Belleville 2009/12/3 Acaz Souza > The jquery framework in past, it use the fx animation, it's true? > > On Dec 2, 4:26 pm, MorningZ wrote: > > How is someone *possibly* supposed to answer that open ended and vague > > question? > > > > On Dec 2, 1:13 pm, Acaz Souza wrote: > > > > > > > > > anyone can help me? > > > > > On Dec 2, 11:31 am, Acaz Souza wrote: > > > > > > Why mootools animations is more smooth than jquery animations? >
Re: [jQuery] get random record?
setTimeout(), which is a plain JavaScript function, should be perfect for the job then. Michel Belleville 2009/12/1 Dave Maharaj :: WidePixels.com > Sorry I should have explained it better. My php will get the record. I just > need help using jquery to get the record every (set time, 60 seconds 120 > seconds or when the user clicks next) > > Basically I want to add a side module to the page which has recent posts > with a avatar of the person who made the post and a brief dscription of the > post and a link to the post. This will change every ("set time" > automaticaly > or if the user clicks next it will pull another random record) > > I just need some help with the function to request a new record via ajax > every xxx time or when user clicks next. I can pull a random record no > problem with $ajax and load it into my area I need, just telling the script > to get a new record duration is where im stuck. > > Sorry and thanks, > > Dave > > -Original Message- > From: brian [mailto:zijn.digi...@gmail.com] > Sent: December-01-09 2:45 PM > To: jquery-en@googlegroups.com > Subject: Re: [jQuery] get random record? > > On Tue, Dec 1, 2009 at 4:33 AM, Michel Belleville > wrote: > > If I were you I wouldn't let JavaScript do the randomizing, I would do > > it server-side instead, providing a request that returns a random > > record and pinging it with a simple AJAX query ; this way, JavaScript > > doesn't need to be aware of what you want to send and it doesn't > > select the id client-side (without the database nearby). > > I agree with Michel. Keep the javascript a simple request with no params > and > let the server script (or even the DB) do the randomising. > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 9.0.709 / Virus Database: 270.14.83/2526 - Release Date: 12/01/09 > 04:29:00 > >
Re: [jQuery] Re: How to update the content of an XML node with JQuery
I'm not sure you can even do that with jQuery the way you'd like to do it. Is it so important to use xml for medium ? Michel Belleville 2009/12/1 karthick > Hi Michel, > > Thank you very much for pointing that, now its clear why it > wasn't updating. But can you give me some idea on how I can achieve > this functionality. I just want to manipulate the xml at client side > using jquery and finally send it back to the server as string. I was > trying with append() and replaceWith() function in vain!! :( > I would like to do it with Jquery because i need some browser > compatibility. Is this really possible with jquery? > > > Thanks for your time > karthick > > On Dec 1, 10:01 pm, Michel Belleville > wrote: > > Easy, you're not working on the original xml string, you're working on a > dom > > object generated using the string as original. It's not attached to your > > theXml variable anymore. > > > > Michel Belleville > > > > 2009/12/1 karthick > > > > > > > > > Hi Guys, > > > > > I have an simple xml dom (which is parsed from a string) like this > > > > > > > > > > > 1 > > > 1 > > > 1 > > > > > > > > > > > Now using the jquery find() method I am able to get the value of > > > PersonId. But what I really want is to modify its value to 30 > > > > > ie after updating the xml it should look like this > > > > > > > > > > > 30 > > > 1 > > > 1 > > > > > > > > > > > Here is the code I am trying with > > > > > > > > var theXml = "<PersonList><Person><PersonId>1</PersonId><LocationId>1</ > > > LocationId><AnswerId>1</AnswerId></Person></PersonList>"; > > > > > $(document).ready(function(){ > > > > > $("#butSub").click(function(event){ > > > theXml = parseXml(theXml); > > > $(theXml).find('Person').each(function(){ > > >$(this).find('PersonId').text("30"); > > >alert($(this).find('PersonId').text()); > //This > > > alert shows the updated value 30 for PersonId node > > > }); > > > alert(theXml); //This alert shows old value 1 for > PersonId > > > node. > > > }); > > > }); > > > function parseXml(xml) > > >{ > > >if (jQuery.browser.msie) > > >{ > > >var xmlDoc = new > ActiveXObject("Microsoft.XMLDOM"); > > >xmlDoc.loadXML(xml); > > >xml = xmlDoc; > > >} > > >return xml; > > >} > > > > > > > > Could you guys tell me where I am going wrong? or Is there any other > > > better way of doing this? > > > > > I really really appreciate your help on this > > > > > Thank you > > > Karthick >
Re: [jQuery] How to update the content of an XML node with JQuery
Easy, you're not working on the original xml string, you're working on a dom object generated using the string as original. It's not attached to your theXml variable anymore. Michel Belleville 2009/12/1 karthick > Hi Guys, > > I have an simple xml dom (which is parsed from a string) like this > > > > 1 > 1 > 1 > > > > Now using the jquery find() method I am able to get the value of > PersonId. But what I really want is to modify its value to 30 > > ie after updating the xml it should look like this > > > > 30 > 1 > 1 > > > > Here is the code I am trying with > > > var theXml = "<PersonList><Person><PersonId>1</PersonId><LocationId>1</ > LocationId><AnswerId>1</AnswerId></Person></PersonList>"; > > $(document).ready(function(){ > > $("#butSub").click(function(event){ > theXml = parseXml(theXml); > $(theXml).find('Person').each(function(){ >$(this).find('PersonId').text("30"); >alert($(this).find('PersonId').text()); //This > alert shows the updated value 30 for PersonId node > }); > alert(theXml); //This alert shows old value 1 for PersonId > node. > }); > }); > function parseXml(xml) >{ >if (jQuery.browser.msie) >{ >var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); >xmlDoc.loadXML(xml); >xml = xmlDoc; >} >return xml; >} > > > > Could you guys tell me where I am going wrong? or Is there any other > better way of doing this? > > I really really appreciate your help on this > > Thank you > Karthick > > >
Re: [jQuery] Two dimensional arrays and $.post
Sorry mate, jQuery won't help here. BUT JavaScript will : { something: "blah", something_else: "hem" } Then you just have to pass it to $.post as explained in the doc http://docs.jquery.com/Ajax/jQuery.post (that's the second parameter, data) Michel Belleville 2009/12/1 ST > Hi list, > > I need to dynamically create an associative array in jquery, then pass > it to a php script for processing (using the $.post method), in order > to receive a value of some sort. > > The array is generated every time the user performs a change in a > select list element, and is of the following structure: > myArray = [ ID => value, ID => value, ..., ID => value] > > My questions: > - How can I define an associative array? > - How can I pass it on a php script using $.post? > > Thanks in advance! > > St >
Re: [jQuery] get random record?
If I were you I wouldn't let JavaScript do the randomizing, I would do it server-side instead, providing a request that returns a random record and pinging it with a simple AJAX query ; this way, JavaScript doesn't need to be aware of what you want to send and it doesn't select the id client-side (without the database nearby). Michel Belleville 2009/12/1 Charlie > link to different random functions depending on db > http://www.petefreitag.com/item/466.cfm > > $getJSON and volia! > > > Dave Maharaj :: WidePixels.com wrote: > > Has anyone come across a simple function that will get a random record from > the db? > > I just need to send a request every min or so to get new content from the > db and change the content. Pretty much like a banner rotator but used for > random content. > > thanks, > > Dave > > >
Re: [jQuery] fadeout doesn't work first time
I think your problem is nothing has the activetab class first, so $(".activetab") selects nothing, you don't start any fadeOut and the fadeIn() callback doesn't get called. Though I'm a bit puzzled as to how it works on the second and subsequent calls (as you don't give the activetab class to any element in the first call, next time shouldn't be any different). I'm also surprised by the method you're using to keep the selected link. I would do this instead : $("a.tabs-link").click(function() { var link = this; $(".activetab").fadeOut(1000, function() { $(this).fadeIn(1000).addClass("activetab") }).removeClass("activetab"); }); Michel Belleville 2009/11/29 ghostrunner > Hey. > I switch betweem three div by clicking on three different link. See > code below. > I use fadein and fadeout to switch between the divs. > The first time i click on one of the links after the pages is loadet > the current div just disappears. It doesn't fadeout. > The second time and everytime after that fadeout works fine. What am i > doing wrong? have tried in both firefox an Internet explorer. > > Code: > HTML > www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> > > > > > > > > > Mod1 > Mod2 > Mod3 > > > Mod1 Mod1 Mod1 Mod1 Mod1 Mod1 Mod1 Mod1 > > > Mod2 Mod2 Mod2 Mod2 Mod2 Mod2 Mod2 Mod2 > > > Mod3 Mod3 Mod3 Mod3 Mod3 Mod3 Mod3 Mod3 > > > > CSS > .abv-content { > display:none; > border: 2px dotted black; > z-index: 50; > margin-left: 200px; > height: 500px; > } > .abv-content.activetab { > display:block; > border: 2px dotted black; > z-index: 50; > margin-left: 200px; > height: 500px; > } > .tabs-nav { > position: absolute; > top: 20px; > left: 20px; > border: 2px solid black; > width: 100px; > margin: 10px 10px 0px 10px; > padding: 2px 0px 5px 10px; > -moz-border-radius: 10px; > list-style-type: none; > z-index: 100; > background-color: green; > } > ---Jquery--- > $(document).ready(function() { > > $("a.tabs-link").click(function() { >var linkIndex=$("a.tabs-link").index(this) >$(".activetab").fadeOut(1000, function() { >$(".abv-content").eq(linkIndex).fadeIn(1000).addClass("activetab") >}).removeClass("activetab"); > }); > }); >
Re: [jQuery] Scroll and select
First of all flash and php are 2 very different things (moreso than flash and javascript which are both client-side) because php is server-side. In fact many sites use both php and flash. Now if you wanna do something like that, you can put all your song names in a list ( with an for each line) and each song title in a link () with the database id of the link somewhere in the href ( for exemple) then bind a callback to the click event on one of your link (preferably through bubbling if your list may be big) that'll copy the inside text of your link (which is the title) to some element (possibly a ) and send a query to your server (preferably using post) including the song's id extracted using a regexp from the link's href. If you're confused on how to do this, here's some good reading : http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery http://docs.jquery.com/Core/jQuery#expressioncontext http://docs.jquery.com/Events/click http://docs.jquery.com/Attributes/attr#name http://docs.jquery.com/Attributes/text http://docs.jquery.com/Ajax/jQuery.post#urldatacallbacktype (the rest of jQuery's documentation's very cool too) Michel Belleville 2009/11/29 xionhack > > Hello. Im trying to make a song request page. Something like: > > http://radio.disney.go.com/speak/request.html > > But that one is done in flash. I did mine with php but I want that option, > that when u click in the song, it will appear in the bottom and u can > submit > it to go to a database. How can I do that? thanks! > -- > View this message in context: > http://old.nabble.com/Scroll-and-select-tp26558814s27240p26558814.html > Sent from the jQuery General Discussion mailing list archive at Nabble.com. > >
Re: [jQuery] Selector Help
Even better : $('a.filter').click(function() { $(this).closest('ul').children().removeClass('active').end().end().closest('li').addClass('active'); }); Michel Belleville 2009/11/29 Mauricio (Maujor) Samy Silva > Try this: > > $('a.filter').click(function(){ > $(this).parent().siblings('li').removeClass('active'); > $(this).parent('li').addClass('active'); > }); > > Maurício > > -Mensagem Original- > *De:* Charlie > *Para:* jquery-en@googlegroups.com > *Enviada em:* domingo, 29 de novembro de 2009 03:56 > *Assunto:* Re: [jQuery] Selector Help > ... > > Dave Maharaj :: WidePixels.com wrote: > How would I go about adding class to the li in this set up? > all > some > none > > ... > > > >
Re: [jQuery] Mark visited links as unvisited...
I don't think you can JavaScript that dude, sorry. Michel Belleville 2009/11/28 emurray100 > I need to mark a link as "unvisited". Any idea how I can do > that in jQuery? > > Note: I'm not talking about css styling, I need to reset the > physical > property to "unvisited". >
Re: [jQuery] Q
Just append another each, that should do the work. $(".whatever").each(function() { /* first this for all */ }).each(function() { /* then that for all */ }) Michel Belleville 2009/11/28 kotchin > hi all > > i was wondering how to add a function to the end of an each loop so > that it executes once all elements in the each array have been > iterated through. > > i would have thought place the function after the closing } of the > each group but this doesn't seem to work - it executes at the same > time as the each loop. > > any thoughts/help? > > thanks > tom >
Re: [jQuery] Switch between five divs
Let's get up to speed a little then : $('#div1, #div2, #div3, #div4, #div5').click(function() { // we can use multiple selectors in one selection, just like in css, and we can give the click callback to all of them at once too $('#div1, #div2, #div3, #div4, #div5').hide(); // we can also hide them all at once, in fact most jQuery's functions may be used on a whole selection at once $(this).show(); // we've hidden all of them, but we know which one we've clicked on, it's been bound to this ; though this is just the dumb dom element, and we need to wrap it in sweet sweet jQuery }); Though I'd suggest not to hide them if you want to click them after, let's see how to do this. Now let's assume you put a div inside each of your divs to handle the content, and put any other element to get the actual click. Like that : click handler for div1 any content you like ... Now we can do something like this : $('#div1 > a, #div2 > a, #div3 > a, #div4 > a, #div5 > a').click(function() { // now we select the direct child link in each div to handle the click $('#div1 > div, #div2 > div, #div3 > div, #div4 > div, #div5 > div').hide(); // we hide all the contents $(this).closest('div').children('div').show(); // closest takes the closest element (parent or self) matching the selector, children takes the children of an element matching the selector }); Hope this gives you a good foretaste of things to come with jQuery ^^ Michel Belleville 2009/11/27 Andre Polykanine > Hello ghostrunner and all, > > There are two methods: show() and hide() respectively. > So you just show the necessary div and hide the four others, like > this: > > $(function () { > $("#div1").click (function (event) { > $(this).show(); > $("#div2").hide(); > $("#div3").hide(); > $("#div4").hide(); > $("#div5").hide(); > }); > }); > > I know it's not so handy (I'm also rather new in jQuery). Maybe > someone will suggest you something else... > > -- > With best regards from Ukraine, > Andre > Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ > jabber.org > Yahoo! messenger: andre.polykanine; ICQ: 191749952 > Twitter: m_elensule > > - Original message - > From: ghostrunner > To: jQuery (English) > Date: Friday, November 27, 2009, 7:40:17 PM > Subject: [jQuery] Switch between five divs > > Hey. > > JQuery is pretty new to me. > > I have five on my site. > Only one of them should be visible at one time. > Next to det div I have 5 links. > i would like to be able to switch between them by cliking on a link > (there is a link for every div). > > I can't figure out how to do this. > >
Re: [jQuery] DataTables plugin - set "id" attribute for table rows?
The id is an html node attribute. You just have to use the same method as for any other attribute, namely : http://docs.jquery.com/Attributes/attr#keyvalue Michel Belleville 2009/11/27 Stodge > My account hasn't been activated on the datatables forum so I need to > ask this question here. Hope this is ok. > > I want to set an id for each row so that I can drag and drop the row > onto another element. But I can't see how to do it from the website. > Does anyone know if this is possible? Thanks >
Re: [jQuery] Problem traversing up list
Well, that must mean that the parent has no id, which is exactly the case : Item 1 <= $('#item1-1').parent().parent() <= $('#item1-1').parent() <= $('#item1-1') Item 1 - 1 Item 1 - 2 Or you can do this in a better way : $('#item1-1').parents('li:first').attr('id') Michel Belleville 2009/11/27 ximo wallas > It returns an empty string, so it alerts, but nothing... > I will show you all the code: > > First I get the id of the element via URL with the URL param plugin: > (It works, if I do an alert it returns the right stuff) > var target = $.url.param("target"); > alert($("#"+target).parent().attr('id')); > > This alerts nothing !! > > --- On *Fri, 11/27/09, Michel Belleville *wrote: > > > From: Michel Belleville > Subject: Re: [jQuery] Problem traversing up list > To: jquery-en@googlegroups.com > Date: Friday, November 27, 2009, 11:10 AM > > > You don't need to use .parentNode() (vanilla DOM) but .parent() (jQuery > flavor). > Then you can access any attribute using .attr(). > > So instead try : $('#item1-1').parent().attr('id') > This should "tadaaa". > > Michel Belleville > > > 2009/11/27 ximo wallas > http://mc/compose?to=igguan...@yahoo.com> > > > >> Hello there, after too much sarching I have almost give it up with the >> following. >> I have a list with another list nested: >> >> Item 1 >> >> >> Item 1 - 1 >> >> >> Item 1 - 2 >> >> >> >> >> Let's say I know the ID of "item1-2" or "item1-1" how can I get the id of >> the li (item1)? >> I have tried with: >> alert($('#item1-1').parentNode().id) >> But it gaves me an error, maybe just because it is an aberration... >> >> >> > >
Re: [jQuery] Binding a function to >1 'a' tag - which approach is best?
Now let's try to simplify this a bit : $('a.c_update').each(function() { var $a = $(this); var q = $a.attr('id'); $a.bind("click", function() { doStuff('getitem',q); // hmm, I don't like this variable much... return false; }); }); $('a.c_update').each(function() { var $a = $(this); $a.bind("click", function() { doStuff('getitem', $a.attr('id');); // there, no need return false; }); }); $('a.c_update').each(function() { var $a = $(this); $a.bind("click", function() { // wait, if I've bound my event to the link, why bother keep it as a variable before ? doStuff('getitem', $a.attr('id');); // there, no need return false; }); }); $('a.c_update').each(function() { $(this).bind("click", function() { // feels better doStuff('getitem', $(this).attr('id');); return false; }); }); $('a.c_update').each(function() { // hey, why bother looping, I could do it all with the .bind() function on the whole collection anyway $(this).bind("click", function() { doStuff('getitem', $(this).attr('id');); return false; }); }); $('a.c_update').bind("click", function() { // how sleaker doStuff('getitem', $(this).attr('id');); return false; }); So, basically you can reduce #1 to #2 breaking nothing, without any significan loss (in fact I think it's a net gain). Michel Belleville 2009/11/27 Bruce MacKay > Hello folks, > > I have some html returned via ajax that contains several 'a' tags to > which I am binding a function. > > Both of the following methods does the job, but my perception of other > posts about this general practice from more wiser folk than me is that > the first method is the "better" method. Is this the case? Which is > the "best" method - and more importantly, why? > > method #1 > $('a.c_update').each(function() { > var $a = $(this); > var q = $a.attr('id'); > $a.bind("click",function() {doStuff('getitem',q);return > false;}); > }); > > method #2 > $('a.c_update').bind("click",function() {doStuff > ('getitem',this.id);return false;}); > > Thanks, > Bruce >
Re: [jQuery] Problem traversing up list
You don't need to use .parentNode() (vanilla DOM) but .parent() (jQuery flavor). Then you can access any attribute using .attr(). So instead try : $('#item1-1').parent().attr('id') This should "tadaaa". Michel Belleville 2009/11/27 ximo wallas > Hello there, after too much sarching I have almost give it up with the > following. > I have a list with another list nested: > > Item 1 > > > Item 1 - 1 > > > Item 1 - 2 > > > > > Let's say I know the ID of "item1-2" or "item1-1" how can I get the id of > the li (item1)? > I have tried with: > alert($('#item1-1').parentNode().id) > But it gaves me an error, maybe just because it is an aberration... > > >
Re: [jQuery] Is there a plugin similar to this Flash effect in Yahoo.com for media images?
This is not a jQuery plugin, this is flash. Though copying this "effect" might be possible (except maybe on Internet Explorer of course) using nothing more than a very tiny bit of JavaScript and png alpha-transparency (hence the maybe impossible on IE). You create two "fading" images (basically a one pixel wide gradient opaque white>transparent white), and you jQuery two divs with these images as background with absolute positionning to place them on both sides of your target element. I'm pretty sure you'll have troubles with IE6 and maybe IE7. Regards. Michel Belleville 2009/11/26 Raymond Ho > Hi guys, > > I'm looking to develop this plugin in jQuery, or is there already an > available version in jQuery for this effect? > http://movies.yahoo.com/feature/hmg-weekend-roundup-11-25-09.html > > I really want the fading effect of the plugin. > > Please tell me. Thanks > >
Re: [jQuery] PHP jQuery on different port
The port is part of the url (80 is implicit for http), so you've got to explicitly set it to access port 8080, like this : http://whatever.yoursite.is:8080/any_script.php?any_other_argument=some_value Michel Belleville 2009/11/26 Darjana > Hello, > > This user.php on port 80 > $callback = $_GET["callback"]; > $user = $_GET["username"]; > > if($user == "lazy") { > $response = array("message" => "SUCESS"); > } else { > $response = array("message" => "FAIL"); > } > > echo $callback . "(". json_encode($response) . ");"; > > This is index.html on port 8080 > > $.getJSON("user.php?callback=?", { username: "lazy"}, function(json){ > alert("JSON Data: " + json.message); // SUCCESS > }); > > This is working if both files on same port, however, it doesn't when > its not on same port > > Any workaround for this to work? >
Re: [jQuery] Returning Value Of aa .POST
$.ajax(), $.get(), $.post(), $.load(), none of these methods return the result of the AJAX call, because they're meant to be asynchronous (the first "A" in AJAX), which means they're working behind the scene, detached from the place they've been called. If they were not they would freeze the interface until the call ends, and most of the time nobody wants that. In order to execute something after the call succeeds you have to use callbacks : http://docs.jquery.com/Ajax/jQuery.post#urldatacallbacktype Michel Belleville 2009/11/26 Nuclear > function ajax_post_var(url, event_id) > { >var info = $.post(url).responseText; >alert(info); >if (event_id == '1') >{ >do something with info... >} >...more if's here... > } > > Why does info show undefined... I'd like to be able to use the > returned value for something else. >
Re: [jQuery] Re: JQuery value set delay
Let me check a little point though, did you set the *id* of your input to "act" or was "act" just the *name* ? Because this selector : $('#act') selects an element that has the *id* "act", whereas in vanilla DOM document.your_form.act points to the element that has the *name* "act". If so, no wonder your field wasn't changed in time, or at all. Michel Belleville 2009/11/26 Adods > i've tried that one too, and get the same result. but now i already > get the solution by using old way: > > document.pm_form.act.value = 'value'; > > btw, thanks for the help :) > > On Nov 24, 9:32 pm, Michel Belleville > wrote: > > I think I've had something similar once, I'm not sure how I got it to > work > > properly but you can try something on lines of : > > setTimeout("$('#pm_form').submit();", 1); > > > > So you've returned and applied the changed before the form actually > submits. > > > > Michel Belleville > > > > 2009/11/24 achmad dodi > Hello, > > > > > I have a problem with submitting a form using a link, multiple link > > > > > here is an example link i'm gonna use: > > > > > Mark as > > >> Read Remove to Trash > > > > > the result I expect is when the link is clicked, a hidden input value > > > replaced with `rel` attribute on the link and then submit the form, and > here > > > is the code: > > > > > $('a.commandBtn').click(function () { > > >> $('#act').val(this.rel); > > >> $('#pm_form').submit(); > > >> return false; > > >> }); > > > > > but after the form submitted, when I check the $_POST['act'] variable > in > > > PHP, it's return a default value. > > > if I disabled the submit line in code above, the value change normally. > > > but when I check it again using Firebug with submit line enabled, the > #act > > > hidden input value change when the form is being submitted. > > > there is some delay when setting a value, as the result, the value is > > > updated when the form is being submitted. > > > > > can anyone give me a solution for this? > > > and sorry for my bad english > > > > > *Regards,* > > > Achmad A. >
Re: [jQuery] Re: (this[0].ownerDocument || this[0]).createDocumentFragment is not a function
I'd like to point out here that you don't really need to place this variable inside the jQuery namespace, you don't even need to enable it to get out of its scope by making it global, so you may do something like that : $(this).bind("click", function(e) { var temp = $(this); // this is a local variable, outside the scope of the function where it's declared it isn't registered anymore $.get("main.php?action=getEventDetails",},function(data) { temp.html(data); // though this anonymous function used as call back has been declare in the scope of temp's holding function, therefore temp is still declared and still holding the reference to former $(this) }); }); And it will still work, temp stays declared as long as the callback needs it, but it doesn't get out from your click callback so no pollution of any namespace or outer scope. Michel Belleville 2009/11/25 coffeecup > thanks, i registered a $.temp var outside of my get function and now > it works! > > $.temp = {}; > > > > $(this).bind("click", function(e){ > $.temp = $(this); > $.get("main.php?action=getEventDetails",},function(data){ > $.temp.html(data); > }); > }); > >
Re: [jQuery] (this[0].ownerDocument || this[0]).createDocumentFragment is not a function
If I were you I'd try to log what "this" is inside your second get's scope, and I bet you'll be surprised to notice it's not what it was outside the second get. That's why you should put your previous "this" in a variable so when "this" changes with the scope the other variable still holds who you'd like to talk to. Michel Belleville 2009/11/24 coffeecup > Hello, > > iam experimenting a little bit with jquery and have encountered the > following problem. > > my project is a calendar which can be browsed and is drawed with ajax > and events can be added, when clicking a day of the current month a > div pops up which contains the overview of the selected day and lists > all events. when clicking on a list item a more detailed info of this > event should appear. > viewing detailed info should only be possible if logged in. > > $(".thismonth").each(function(){ // for every day of the month > $(this).bind("click", function(e){ // click handler > $.get("main.php?action=getEventList"),function(data){ // get > eventdata of the selected day > $("#eventdetails").html(data); // display events of the > selected day > $(".event").each(function(){ // for each event in the list >$(this).bind("click", function(e){ add click handler for event > in the list > $.get("main.php?action=getEvenDetails"),function(data){ // get > detailed info if logged in > $(this).html(data); // display detailed info > }); > . > > so.. if i skip the 2nd $.get request and use just $(this).html > ('test'); it works fine, when using get i get the following error (this > [0].ownerDocument || this[0]).createDocumentFragment is not a > function. > > > > > >
Re: [jQuery] Re: Where to place my code on AJAX calls
jQuery provides : jQuery(function() { // this is executed as soon as the page is fully loaded }); Michel Belleville 2009/11/24 Rockinelle > How do I make sure the external page is fully loaded before I try to > bind events to it? > > On Nov 24, 9:43 am, Michel Belleville > wrote: > > You can use live as soon as your page can execute JavaScript as far as > I'm > > aware, though if you mix the approaches (live can't do everything bound > > events can do, for exemple catching a form submission as for now) you'd > > probably stay on the safer side doing everything once the page is fully > > loaded. > > > > Michel Belleville > > > > 2009/11/24 Rockinelle > > > > > Ok the live technique worked, thanks! I understand the idea of binding > > > it after the documents is loaded. Is that more than a matter of > > > binding it after the ajax call, or *must* I use .live so that it waits > > > for the page to load before binding? > > > > > On Nov 24, 6:17 am, bhu Boue vidya wrote: > > > > i think its because you are binding the handler to a DOM element > > > > before it exists > > > > > > if you use the 'live' method you may get what you want > > > > > > ie > > > > > > $().ready(function() { > > > > $('#submit1').live('click', function() { > > > > alert('it works!'); > > > > }); > > > > > > }); > > > > > > alternately, bind the event handler *after* the content is loaded via > > > > ajax > > > > > > On Nov 24, 7:39 am, Rockinelle wrote: > > > > > > > I am jumping into ajax with Jquery and I have what I think is an > easy > > > > > question. I have successfully used jquery load to bring an external > > > > > php doc into my page. That page has a form on it where I want to > use > > > > > jquery to reload that external page to reload with ajax when the > form > > > > > is submitted. What I need to know is where to put the code to act > on > > > > > the external form. Do I place the code on the page .load ing the > > > > > external form or do I need to place it on the external form? > > > > > > > I've tried it both ways and I can't get it to work. > > > > > For testing I'm just doing something simple > > > > > $(document).ready(function(){ > > > > > $('#submit1').click(function(){ > > > > > alert('It works!'); > > > > > }); > > > > > }); > > > > > This code does work when it's located on the external form and I > load > > > > > that form explicitly rather than through an ajax call. What am I > > > > > missing? > > > > > > > I guess my question has a greater scope than just this example. > Will > > > > > javascript on a main page act on selectors that match those in a > div > > > > > that's loaded through ajax? The same question with CSS too. >
Re: [jQuery] Re: Where to place my code on AJAX calls
You can use live as soon as your page can execute JavaScript as far as I'm aware, though if you mix the approaches (live can't do everything bound events can do, for exemple catching a form submission as for now) you'd probably stay on the safer side doing everything once the page is fully loaded. Michel Belleville 2009/11/24 Rockinelle > Ok the live technique worked, thanks! I understand the idea of binding > it after the documents is loaded. Is that more than a matter of > binding it after the ajax call, or *must* I use .live so that it waits > for the page to load before binding? > > On Nov 24, 6:17 am, bhu Boue vidya wrote: > > i think its because you are binding the handler to a DOM element > > before it exists > > > > if you use the 'live' method you may get what you want > > > > ie > > > > $().ready(function() { > > $('#submit1').live('click', function() { > > alert('it works!'); > > }); > > > > }); > > > > alternately, bind the event handler *after* the content is loaded via > > ajax > > > > On Nov 24, 7:39 am, Rockinelle wrote: > > > > > I am jumping into ajax with Jquery and I have what I think is an easy > > > question. I have successfully used jquery load to bring an external > > > php doc into my page. That page has a form on it where I want to use > > > jquery to reload that external page to reload with ajax when the form > > > is submitted. What I need to know is where to put the code to act on > > > the external form. Do I place the code on the page .load ing the > > > external form or do I need to place it on the external form? > > > > > I've tried it both ways and I can't get it to work. > > > For testing I'm just doing something simple > > > $(document).ready(function(){ > > > $('#submit1').click(function(){ > > > alert('It works!'); > > > }); > > > }); > > > This code does work when it's located on the external form and I load > > > that form explicitly rather than through an ajax call. What am I > > > missing? > > > > > I guess my question has a greater scope than just this example. Will > > > javascript on a main page act on selectors that match those in a div > > > that's loaded through ajax? The same question with CSS too. >
Re: [jQuery] GET id value from url in jQuery
When someone .click(function() { ... }) on $(this), $(this) is very interesting, and I'm not saying that just because $(this).attr('href') is even more relevant to your interests. And $(this) is also interesting when you're running through .each(function() { ... }) elements of a $('#jquery .collection_of_items'), or after $('.an_element').sideUp('slow', function() { ... }), or on most jQuery collection methods. Michel Belleville 2009/11/24 dziobacz > How can I take value of ID clicked link in jQuery ?? > I have links: > delete > delete > delete > . > > My jQuery script: > $(document).ready( function () >{ >$(".delete").click(function() >{ >$.post("deleting_posts.php", { id: > WHAT_HERE_?? }, function(data) >{ >.. >}); >return false; >}); >}); > > How can I take value of ID clicked link in jQuery ?? >
Re: [jQuery] problem in slider effect
First of all a little advice, it's probably better to use jQuery's event management than placing onMouseOver or onMouseOut in your html. Here's how to do it : jQuery(function($) { $('.opener').mouseover( function() { $("#test").slideDown("slow"); } ); $('#test').mouseout( function() { $("#test").slideUp("slow"); } ); }); And a little change in the html to locate the opener link : Click me! ... The benefits are it's not intrusive so you can pack your JavaScript code in a .js file which is cleaner, plus you can pack the inline style in a css attached to the "opener" class. Now for your actual problem here, unless you order otherwise, animations pile up on top of one another in the animation queue of an element and get executed in that order, one by one. So here's what I think happen : 1. you hover on the link, the slideDown starts 2. you move your mouse and hover just a little on the sliding div while it's sliding, you don't necessarilly notice it but your browser does and stacks the slideUp on top of the queue 3. the slideDown completes, the next animation is starts, and it's the slideUp you just piled on top First things first, it may be better to stop previous animation and start the slideUp as soon as you hover out the test zone (and vice-versa) using http://docs.jquery.com/Effects/stop : jQuery(function($) { $('.opener').mouseover( function() { $("#test").stop(true).slideDown("slow"); } ); $('#test').mouseout( function() { $("#test").stop(true).slideUp("slow"); } ); }); Now, I don't know exactly what effect you're really after, but if I were you maybe I wouldn't trigger the slideUp on exiting the text zone itself, but a parent common to both your hovered link and the text zone, like this : jQuery(function($) { $('#test').parent().hover( function() { $("#test").stop(true).slideDown("slow"); }, function() { $("#test").stop(true).slideUp("slow"); } ); }); And the html : Hover me ! ... This way, as long as you don't exit the container, #test is shown, as soon as you exit the whole of it it's hidden. Michel Belleville 2009/11/24 swetha > Hi, > > I am new to jQuery and I have a doubt in slider effect. I just wanted > to replace js with jQuery in my website. > > I have a dropdown link in my site, for that i am using slideDown, > slideUp effects. I need slideDown for onMouseOver and slideUp for > onMouseOut. I gave slideDown link to the text and slideUp to the > dropdown div which shows on slidedown effect. > > When I mouse over the link, the drop-down shows properly but, when I > move the mouse over the dropdown div, its getting closed. Actually I > need to close it only when I move out of the dropdown div. > > > Here is my code. > --- > > > > > > > function divopen() > { > jQuery("#test").slideDown("slow"); > } > > function divhide() > { > jQuery("#test").slideUp("slow"); > } > > > > div#test { background:#F7F7F7; top:54px; left:1px; width:200px; > border:1px solid green; float:left; } > > > > Click me! > > > The minified versions, while having a larger file size > The minified versions, while having a larger file size than the > packed versions > The minified versions, while having a larger file size than the > packed versions > The minified versions, while having a larger file size than the > packed versions > The minified versions, while having a larger file size than the > packed versions > The minified versions, while having a larger file size than the > packed versions > > > > > > Please help me to fix the issue... > > Thanks, > Prakash >
Re: [jQuery] JQuery value set delay
I think I've had something similar once, I'm not sure how I got it to work properly but you can try something on lines of : setTimeout("$('#pm_form').submit();", 1); So you've returned and applied the changed before the form actually submits. Michel Belleville 2009/11/24 achmad dodi > Hello, > > I have a problem with submitting a form using a link, multiple link > > here is an example link i'm gonna use: > > Mark as >> Read Remove to Trash >> > > the result I expect is when the link is clicked, a hidden input value > replaced with `rel` attribute on the link and then submit the form, and here > is the code: > > $('a.commandBtn').click(function () { >> $('#act').val(this.rel); >> $('#pm_form').submit(); >> return false; >> }); > > > but after the form submitted, when I check the $_POST['act'] variable in > PHP, it's return a default value. > if I disabled the submit line in code above, the value change normally. > but when I check it again using Firebug with submit line enabled, the #act > hidden input value change when the form is being submitted. > there is some delay when setting a value, as the result, the value is > updated when the form is being submitted. > > can anyone give me a solution for this? > and sorry for my bad english > > *Regards,* > Achmad A.
Re: [jQuery] jquery help
Hmm, seems like the url on craig's list is stale or something, but as soon as I get more details it's possible that I can point to the cause of your troubles. Regards. Michel Belleville 2009/11/24 Bjorn Symister > Thanks Michael, and I wont take it the wrong way, its business, nothing > personal :). For some reason I think I’m just not explaining myself > properly. I have written the code according to how I stated the problem and > the data does not get transferred. I have placed the problem up on > craigslist yesterday as a paid gig. The link is “ > http://newyork.craigslist.org/que/cpg/1479652385.html”.<http://newyork.craigslist.org/que/cpg/1479652385.html%E2%80%9D.> > If you know how to solve it, feel free to quote me a price. > > Once again thanks for all your help thus far and assistance in this matter. > Until next time. > > Sincerely, > > Bjorn > > On 11/24/09 2:11 AM, "Michel Belleville" > wrote: > > Right. Don't take it the wrong way but here's how it works on a mailing > list where people help you for free, you don't ask people to do your job for > you. Instead, what you could be doing is, try to do things, encounter > problems, ask about the specific problems you're encountering, and usually > get an answer which helps you go further by yourself. > > This being said, and even if I was volunteering to write a script for you, > I still lack a lot of data here. So here's what you can do right now : > >- try using http://docs.jquery.com/Ajax/jQuery.getJSON and see if it >works for you (it allows to do XSS as far as I'm aware) >- when it fails and you've got a specific question to ask, come back >and ask it > > >Regards. > >Michel Belleville > > >2009/11/24 Bjorn Symister > >I apologize for not being clear. I am not getting the information I >need on (Server1) from (Server2). Would you be able to send me a codd >snippet that will pass the information. One for the scripting server and >the other for the client server. I am collecting email information. > >Thanks, > > >Bjorn > > >On 11/23/09 3:04 PM, "Michel Belleville" >wrote: > >Good, now I know your server architecture in details. > > Still you forgot to mention what problem you are facing, and how it >relates to jQuery. As far as I can see using your reply you're using the >right method, and I don't see any error or problem you should be facing >here. > >Michel Belleville > > >2009/11/23 Bjorn Symister > >Thanks Michael for helping out. > >I have two servers. > >Server 1: Scripting Server – I have full control over this server and >this is where all server side script goes. >Server 2: Client Server – I cannot put any server side script (such as >php) on this server. Only HTML, CSS, Javascript. > >I have to work under the above conditions. > >I have a form on (Server 2), that collects user data. I need to store >that user data on (Server 1). My limitations are that I cannot refresh the >entire page, only parts of the page. > >Ajax Limitations: Does not work cross domain unless: using php, local >proxy, iFrame, JSON. > >My only option is to use JSON. So What I need is on: >On (Server2) package the data in a JSON format, so that when (Server1) >goes to the URL of (Server2), it will see the JSON data with the values I >need. Take those values. > >I know how to read the values and have the code on (Server1). Its >setting things up on (Server2) I have a problem with. > >Hope that clarifies things :) > >Bjorn > > > >On 11/23/09 1:04 PM, "Michel Belleville" >wrote: > >Using solely the content of your message I've deduced that : > 1. you're facing a problem > 2. you're using jQuery > 3. something that is composed of two files containing stuff isn't > doing whatever it's meant to be doing using functions and probably > gizmos > I've got the first and second point, though the third is not quite >as clear. Maybe your code would help, plus a description of what it's meant >to do ?... > >Michel Belleville > > >2009/11/19 shobhit > >sir i am facing problem while using jquery: > > > i have two different .js file both r include in one page >and having same type of function like >function() > > >so they r not working at same time... >plz help me out of this problem .. > thanx in advance > > > > > > > > >
Re: [jQuery] update div with textarea length
As long as it's working now kudos. Regards. Michel Belleville 2009/11/24 rjc > > I'm sorry Michel, I edited my last reply because I found the error of it > not > working was on my behalf. > > Michel Belleville wrote: > > > > Maybe the problem is somewhere else then. Strings have a .length which is > > the number of characters in them, .val() gets the value of the first > > element > > selected (input, texarea, select, etc.) and $(this) should only point to > > your textarea when it's responding to the keyup event. Could you show the > > updated code and the associated html maybe ? > > > > Michel Belleville > > > > > > 2009/11/24 rjc > > > >> > >> I would have never thought to use val(), but this solution unfortunately > >> did > >> not work > >> The value still remains as 1 ? > >> -- > >> View this message in context: > >> > http://old.nabble.com/update-div-with-textarea-length-tp26492474s27240p26492632.html > >> Sent from the jQuery General Discussion mailing list archive at > >> Nabble.com. > >> > >> > > > > > > -- > View this message in context: > http://old.nabble.com/update-div-with-textarea-length-tp26492474s27240p26492799.html > Sent from the jQuery General Discussion mailing list archive at Nabble.com. > >
Re: [jQuery] update div with textarea length
Maybe the problem is somewhere else then. Strings have a .length which is the number of characters in them, .val() gets the value of the first element selected (input, texarea, select, etc.) and $(this) should only point to your textarea when it's responding to the keyup event. Could you show the updated code and the associated html maybe ? Michel Belleville 2009/11/24 rjc > > I would have never thought to use val(), but this solution unfortunately > did > not work > The value still remains as 1 ? > -- > View this message in context: > http://old.nabble.com/update-div-with-textarea-length-tp26492474s27240p26492632.html > Sent from the jQuery General Discussion mailing list archive at Nabble.com. > >
Re: [jQuery] update div with textarea length
Little confusion here indeed : jQuery wraps selected elements in a "magic array" that keep them warm and ready to respond to any jQuery method, so when you query $(this).length you're asking for jQuery's "magic array"'s length, which is 1 (1 element inside). If you want to get the length of the string inside the element, use .val() to get the element's value : $(this).val().length This should do the trick. Regards. Michel Belleville 2009/11/24 rjc > > Hi, i'm updating a div with the length of a textarea. > > > $().ready(function(){ >$("#formElement_profileTeamProfile").keyup(function() { > >var newText = $(this).length; >$('#countCharTeamProfile').html(newText); > >}); > }); > > > Every time i enter a char into the textarea, the value stays at 1. > :confused: > > I am very new to any jQuery, i've been searching with no luck for hours! > > any help would be greatly appreciated! > > J. > -- > View this message in context: > http://old.nabble.com/update-div-with-textarea-length-tp26492474s27240p26492474.html > Sent from the jQuery General Discussion mailing list archive at Nabble.com. > >
Re: [jQuery] Dynamically Changing the Stored Height of a Parent Div Based on a Child's Content
Doesn't Disqus provide you with a callback of any sort in it's api ? Otherwise maybe you can watch out for dom changes and make it trigger your resizing method. And if you're really desperate there's always good old "let's execute that periodically until whatever happens". Michel Belleville 2009/11/24 Dave > I have a comment form that is fed by Disqus. It is in a div that is > scrolled with ui.slider. > > The problem is, I determine the maxScroll by calculating teh > difference between the scrolling content and the viewport. Work great > all across the site except here. > > Reason is, the var fot the div's heigh is set when the page loads. > Then the Disqus content loads, and the height var doesn't know that > the dom is not full of content. > > SO how can I update the height of a parent div when ever a child's > height changes. > > Any ideas? >
Re: [jQuery] jquery help
Right. Don't take it the wrong way but here's how it works on a mailing list where people help you for free, you don't ask people to do your job for you. Instead, what you could be doing is, try to do things, encounter problems, ask about the specific problems you're encountering, and usually get an answer which helps you go further by yourself. This being said, and even if I was volunteering to write a script for you, I still lack a lot of data here. So here's what you can do right now : - try using http://docs.jquery.com/Ajax/jQuery.getJSON and see if it works for you (it allows to do XSS as far as I'm aware) - when it fails and you've got a specific question to ask, come back and ask it Regards. Michel Belleville 2009/11/24 Bjorn Symister > I apologize for not being clear. I am not getting the information I need > on (Server1) from (Server2). Would you be able to send me a codd snippet > that will pass the information. One for the scripting server and the other > for the client server. I am collecting email information. > > Thanks, > > > Bjorn > > > On 11/23/09 3:04 PM, "Michel Belleville" > wrote: > > Good, now I know your server architecture in details. > > Still you forgot to mention what problem you are facing, and how it relates > to jQuery. As far as I can see using your reply you're using the right > method, and I don't see any error or problem you should be facing here. > > Michel Belleville > > > 2009/11/23 Bjorn Symister > > Thanks Michael for helping out. > > I have two servers. > > Server 1: Scripting Server – I have full control over this server and this > is where all server side script goes. > Server 2: Client Server – I cannot put any server side script (such as php) > on this server. Only HTML, CSS, Javascript. > > I have to work under the above conditions. > > I have a form on (Server 2), that collects user data. I need to store that > user data on (Server 1). My limitations are that I cannot refresh the > entire page, only parts of the page. > > Ajax Limitations: Does not work cross domain unless: using php, local > proxy, iFrame, JSON. > > My only option is to use JSON. So What I need is on: > On (Server2) package the data in a JSON format, so that when (Server1) goes > to the URL of (Server2), it will see the JSON data with the values I need. > Take those values. > > I know how to read the values and have the code on (Server1). Its setting > things up on (Server2) I have a problem with. > > Hope that clarifies things :) > > Bjorn > > > > On 11/23/09 1:04 PM, "Michel Belleville" > wrote: > > Using solely the content of your message I've deduced that : > >1. you're facing a problem >2. you're using jQuery >3. something that is composed of two files containing stuff isn't doing >whatever it's meant to be doing using functions and probably gizmos > > I've got the first and second point, though the third is not quite as > clear. Maybe your code would help, plus a description of what it's meant to > do ?... > > Michel Belleville > > > 2009/11/19 shobhit > > sir i am facing problem while using jquery: > > > i have two different .js file both r include in one page > and having same type of function like > function() > > > so they r not working at same time... > plz help me out of this problem .. > thanx in advance > > > > > >
Re: [jQuery] Where to place my code on AJAX calls
Welcome to the unobtrusive philosophy : http://simonwillison.net/static/2008/xtech/ This is somewhat big to take in one big gulp but I promise you will greatly benefit from reading this right now before you try to use jQuery and AJAX in a messier way and find it hard and not rewarding. Kind regards. Michel Belleville 2009/11/23 Rockinelle > I am jumping into ajax with Jquery and I have what I think is an easy > question. I have successfully used jquery load to bring an external > php doc into my page. That page has a form on it where I want to use > jquery to reload that external page to reload with ajax when the form > is submitted. What I need to know is where to put the code to act on > the external form. Do I place the code on the page .load ing the > external form or do I need to place it on the external form? > > I've tried it both ways and I can't get it to work. > For testing I'm just doing something simple > $(document).ready(function(){ >$('#submit1').click(function(){ >alert('It works!'); >}); >}); > This code does work when it's located on the external form and I load > that form explicitly rather than through an ajax call. What am I > missing? > > I guess my question has a greater scope than just this example. Will > javascript on a main page act on selectors that match those in a div > that's loaded through ajax? The same question with CSS too. >
Re: [jQuery] Re: Sorting spans which are in li elements.
Indeed here's a typical example where a table would fit, and a definetly a table sorter plugin. Though I don't know how much latitude he has depending on the expected styling and wether he's allowed to change html code. Michel Belleville 2009/11/23 amuhlou > My initial reaction is that your information might be more suited to a > table, in which case you could use the tablesorter plugin. > > http://tablesorter.com/docs/ > > On Nov 21, 5:58 pm, "javam.org" wrote: > > Hi there, > > > > My xhtml structure looks like: > > > > > > > > Name > > Remaining Time > > Status > > > > > > > > > > Name value 1 > > Time value 1 > > Status value 1 > > > > > > Name value 1 > > Time value 2 > > Status value 3 > > > > > > Name value 3 > > Time value 3 > > Status value 3 > > > > > > > > > > > > I am trying to sort span values for Name, Time and Status.. > > I can implement to just only one menu item by adding , > ="2"> ... which covers li elments. But it cannot provide my needs. I > > have to implement it to all. > > > > When I click time menu element (let assume "Time value 2" is greater > > than "Time value 3" and "Time value 3" is greater than "Time value > > 1"), all s2 spans should be at the top of the list... looks like: > > > > > > > > Name > > Remaining Time > > Status > > > > > > > > > > Name value 1 > > Time value 1 > > Status value 1 > > > > > > Name value 1 > > Time value 2 > > Status value 3 > > > > > > Name value 3 > > Time value 3 > > Status value 3 > > > > > > > > > > > > And should be available for other menu elements also... > > > > Could you show me the ways to do it? > > > > Best Regards. >
Re: [jQuery] Sorting spans which are in li elements.
I'd select the spans bearing the same class as the clicked element, pick their parent lis and put them back in order. To select elements bearing the s1 class in an the aptly named "list" : $('#list .s1') To pick an element's closest li : element.closest('li') To remove an element from its current location : element.remove() Removing the element returns the nodes all the same so you can append it somewhere else using : element.appendTo(somewhere()) I guess you know how to sort an array : array.sort() And jQuery being very similar to construction games, it's funnier when you do the assembling yourself once you've got all the parts and a plan. Michel Belleville 2009/11/21 javam.org > Hi there, > > My xhtml structure looks like: > > > >Name >Remaining Time >Status > > > > >Name value 1 >Time value 1 >Status value 1 > > >Name value 1 >Time value 2 >Status value 3 > > >Name value 3 >Time value 3 >Status value 3 > > > > > > > I am trying to sort span values for Name, Time and Status.. > I can implement to just only one menu item by adding , ="2"> ... which covers li elments. But it cannot provide my needs. I > have to implement it to all. > > When I click time menu element (let assume "Time value 2" is greater > than "Time value 3" and "Time value 3" is greater than "Time value > 1"), all s2 spans should be at the top of the list... looks like: > > > >Name >Remaining Time >Status > > > > >Name value 1 >Time value 1 >Status value 1 > > >Name value 1 >Time value 2 >Status value 3 > > >Name value 3 >Time value 3 >Status value 3 > > > > > > And should be available for other menu elements also... > > Could you show me the ways to do it? > > Best Regards. >
Re: [jQuery] jquery help
Good, now I know your server architecture in details. Still you forgot to mention what problem you are facing, and how it relates to jQuery. As far as I can see using your reply you're using the right method, and I don't see any error or problem you should be facing here. Michel Belleville 2009/11/23 Bjorn Symister > Thanks Michael for helping out. > > I have two servers. > > Server 1: Scripting Server – I have full control over this server and this > is where all server side script goes. > Server 2: Client Server – I cannot put any server side script (such as php) > on this server. Only HTML, CSS, Javascript. > > I have to work under the above conditions. > > I have a form on (Server 2), that collects user data. I need to store that > user data on (Server 1). My limitations are that I cannot refresh the > entire page, only parts of the page. > > Ajax Limitations: Does not work cross domain unless: using php, local > proxy, iFrame, JSON. > > My only option is to use JSON. So What I need is on: > On (Server2) package the data in a JSON format, so that when (Server1) goes > to the URL of (Server2), it will see the JSON data with the values I need. > Take those values. > > I know how to read the values and have the code on (Server1). Its setting > things up on (Server2) I have a problem with. > > Hope that clarifies things :) > > Bjorn > > > > On 11/23/09 1:04 PM, "Michel Belleville" > wrote: > > Using solely the content of your message I've deduced that : > >1. you're facing a problem >2. you're using jQuery >3. something that is composed of two files containing stuff isn't doing >whatever it's meant to be doing using functions and probably gizmos > > I've got the first and second point, though the third is not quite as > clear. Maybe your code would help, plus a description of what it's meant to > do ?... > > Michel Belleville > > > 2009/11/19 shobhit > > sir i am facing problem while using jquery: > > > i have two different .js file both r include in one page > and having same type of function like > function() > > > so they r not working at same time... > plz help me out of this problem .. > thanx in advance > > > >
Re: [jQuery] Get URL from a DIV which was loaded with $.load();
Unless you store it you loose it. I suggest adding code in the .load() callback that'll store the url in the div. Michel Belleville 2009/11/23 tobias.br...@me.com > Hello, > > is there any way to get the URL from a div which was previously loaded > via $.load(); ? > > For example from: > > $('#div').load('http://www.google.de'); > > > > Tobias >
Re: [jQuery] jquery help
Using solely the content of your message I've deduced that : 1. you're facing a problem 2. you're using jQuery 3. something that is composed of two files containing stuff isn't doing whatever it's meant to be doing using functions and probably gizmos I've got the first and second point, though the third is not quite as clear. Maybe your code would help, plus a description of what it's meant to do ?... Michel Belleville 2009/11/19 shobhit > sir i am facing problem while using jquery: > > > i have two different .js file both r include in one page > and having same type of function like >function() > > > so they r not working at same time... > plz help me out of this problem .. > thanx in advance >
Re: [jQuery] Write jQuery Data
Oh, and to serialize your stuff, you can use the nifty serialize method jQuery provides for the forms : http://docs.jquery.com/Ajax/serialize ; basically you input a form, it outputs a JSON string containing its data. Michel Belleville 2009/11/23 Michel Belleville > Well, to store things client-side you've already got it halfway, you know > how to store stuff. > > Now you retrieve it the same way, except you don't pass the second > parameter. > var my_acorn = $('div').data('test'); > > Nothing tough here. > (that's all in the doc I've given you anyway) > > Now if you wanted to query your server and get json data, .getJSON() is > your best bet indeed, and http://docs.jquery.com/Getjson will tell you > exactly how to use it. I'll let you handle the server-side part using your > favorite flavour of server, language and data storage. > > Michel Belleville > > > 2009/11/23 Bjorn Symister > > Hi Michael, could you elaborate a bit more. I am completely lost... >> >> If I was to store the data as such “ $("div").*data*("test", { first: 16, >> last: "pizza!" }); >> . How would I retrieve that data from a remote server using .getJSON or >> something similar? >> >> Thanks for your help. >> >> >> >> On 11/23/09 4:45 AM, "Michel Belleville" >> wrote: >> >> The jQuery way uses this method : http://docs.jquery.com/Data >> Another is to hide an html element that holds your data, but you'll >> probably like .data() better. >> >> Michel Belleville >> >> >> 2009/11/22 Niche >> >> I have 2 servers, a front end and a backend. I cannot execute server >> side scripts on the front end server. I need to get information from >> a form and pass it to my backend server. I must use Ajax for this. I >> am doing this with jQuery. I would like to store the form field >> information in JSON format and then read it on the backend server. >> How would I go about this, thanks. >> >> >> >> >
Re: [jQuery] Write jQuery Data
Well, to store things client-side you've already got it halfway, you know how to store stuff. Now you retrieve it the same way, except you don't pass the second parameter. var my_acorn = $('div').data('test'); Nothing tough here. (that's all in the doc I've given you anyway) Now if you wanted to query your server and get json data, .getJSON() is your best bet indeed, and http://docs.jquery.com/Getjson will tell you exactly how to use it. I'll let you handle the server-side part using your favorite flavour of server, language and data storage. Michel Belleville 2009/11/23 Bjorn Symister > Hi Michael, could you elaborate a bit more. I am completely lost... > > If I was to store the data as such “ $("div").*data*("test", { first: 16, > last: "pizza!" }); > . How would I retrieve that data from a remote server using .getJSON or > something similar? > > Thanks for your help. > > > > On 11/23/09 4:45 AM, "Michel Belleville" > wrote: > > The jQuery way uses this method : http://docs.jquery.com/Data > Another is to hide an html element that holds your data, but you'll > probably like .data() better. > > Michel Belleville > > > 2009/11/22 Niche > > I have 2 servers, a front end and a backend. I cannot execute server > side scripts on the front end server. I need to get information from > a form and pass it to my backend server. I must use Ajax for this. I > am doing this with jQuery. I would like to store the form field > information in JSON format and then read it on the backend server. > How would I go about this, thanks. > > > >
Re: [jQuery] Re: Problem with plugins
First of all, if this is a .js script, why is there html in the first few lines ? Michel Belleville 2009/11/23 Paulodemoc > Its the javasscript on the php page, and the only php there is to > output the urls, and these urls are being printed correctly > The url doesn't affect the understanding of the rest of the code... > > On Nov 19, 3:08 pm, Michael Geary wrote: > > Can you post a link to a test page? > > > > It's impossible to tell what is wrong from the .js file you attached. > It's > > not even JavaScript code: it's PHP code. > > > > The browser doesn't ever see your PHP code. All it sees is the *output* > of > > the PHP code. There could be any number of things wrong, but there's no > way > > to tell what they may be without seeing that actual output in a test > page. > > > > -Mike > > > > On Thu, Nov 19, 2009 at 8:03 AM, Paulo Henrique >wrote: > > > > > Can someone help me find any problem with the code attached? > > > I am using it on a website, but its happening a problem with some of my > > > plugins... I use all of them on other websites and they all work fine, > > > but on this one, some aren't working. > > > When I call the editable plugin, it throws an error message saying > editable > > > is not a function... the same happens with sortable, from jquery-ui... > > > On another website I'm working, this happens with ALL jquery plugins. > > > > > Does anyone know what might be causing this? > > > > > Att. > > > Paulo Henrique Vieira Neves > > > Bsc. Sistemas de Informação > > > +55 38 9141 5400 > > > MSN: paulode...@live.com > > > GTALK: paulode...@gmail.com > > > SKYPE: paulodemoc >
Re: [jQuery] Problem with lock of browser after $.ajax call
Could you provide an url to the page or something so we can help diagnose ? Michel Belleville 2009/11/21 Michael Holm Kristensen > Hi, > > I have a problem with some of my jquery code.. i will make this short > an straight ahead. > > What i want is: > > 1. page that will print a loader bar to begin with. > 2. make a ajax call to some information from an external source. > 3. print the information from external source when i get the response. > > Everything works just fine.. by now: > > here is some of my code: > > server: > $sample = array( 'name' => 'Michael' ); > > echo(json_encode($sample)); > ?> > > client: > > $(document).ready(function(){ > $("#ForecastSchema").html('<p> </p><p align="center"><img > src="/img/ajax-loader.gif" width="220" height="19" /></p><p>Please > wait while we fetch the lastest data from weather.com.</p>'); > > $.ajax({ > type: "GET", > url: "/ajax/get_forecast.php", > async: true, > success: function(msg){ $("#ForecastSchema").html > (msg); }, > }); > }); > > > > > And everything above works just fine.. > > My problem is if i put a sleep(120); in my server, and fake a delay.. > My browser will suddently just lock the page, i cannot click on any > links on the page untill the 2 minutes has past. > > I have also tried to put a timeout in the ajax call, but nothing > helps.. i have also tried to play with async, and nothing help here > neither.. > > hope that someone can help me, how i can ex. navigate back to the > frontpage while the page is loading..? >
Re: [jQuery] Write jQuery Data
The jQuery way uses this method : http://docs.jquery.com/Data Another is to hide an html element that holds your data, but you'll probably like .data() better. Michel Belleville 2009/11/22 Niche > I have 2 servers, a front end and a backend. I cannot execute server > side scripts on the front end server. I need to get information from > a form and pass it to my backend server. I must use Ajax for this. I > am doing this with jQuery. I would like to store the form field > information in JSON format and then read it on the backend server. > How would I go about this, thanks. >
Re: [jQuery] Why would jQuery be undefined in IE, but not FF???
The missing > issue mentionned by MorningZ might be your killer then. Michel Belleville 2009/11/20 Rick Faircloth > Thanks for the reminder on that one, Michel...I checked that to make sure > > the load sequence was correct, and it is… > > > > src="js/jquery-1.2.1.pack.js"> > > src="js/jquery.cycle.2.03.pack.js"> > > > > Rick > > > > *From:* Michel Belleville [mailto:michel.bellevi...@gmail.com] > *Sent:* Friday, November 20, 2009 12:29 PM > > *To:* jquery-en@googlegroups.com > *Subject:* Re: [jQuery] Why would jQuery be undefined in IE, but not FF??? > > > > Well, the most obvious idea that's coming to my mind would be to check > wether your jQuery loader line comes before the plugin's loading > line. If not, the code of the plugin, which requires jQuery, will lack > jQuery and fail. > > Michel Belleville > > 2009/11/20 Rick Faircloth <r...@whitestonemedia.com> > > Even stranger… > > > > I went back to another site where I have the cycle plug-in successfully > running > > on IE and FF to retrieve the versions of jquery core and cycle plug-in that > are working. > > > > I put those into the site at www.holtzmanrealestate.com and I get the same > problem > > as before… > > > > ‘jQuery’ is undefined (line 10 of jquery.cycle.2.03.pack.js) > > and > ‘jQuery’ is undefined (line 90 www.holtzmanrealestate.com, which refers to > the > > cycle plug-in script as defined below.) > > > > What could possibly be the issue? > > > > Rick > > > > *From:* Rick Faircloth [<a rel="nofollow" href="mailto:r...@whitestonemedia.com">mailto:r...@whitestonemedia.com</a>] > *Sent:* Friday, November 20, 2009 11:36 AM > *To:* jquery-en@googlegroups.com > *Subject:* [jQuery] Why would jQuery be undefined in IE, but not FF??? > > > > Hi, all… > > > > Anyone have any idea about this? First time I’ve seen it… > > > > I using Mike Alsup’s cycle plug-in to cross fade three photos. > > When I first set this up, it worked fine in IE and FF. > > > > Now, however, the code only works in FF. IE7 & IE8 (at a minimum), > > return the error messages: > > > > ‘jQuery’ is undefined > > jquery.cycle.all.2.65.min.js (line 16) > > > > Line 16 refers to the first line of code in jquery.cycle.all.2.65.min.js, > that starts: > > ;(function($){var > ver="2.65";if($.support==undefined){$.support={opacity:!($.browser.msie)};}function > log(){if(window.console&&window.console.log){ etc… > > > > The next error message returned by IE is: > > ‘jQuery’ is undefined > > www.holtzmanrealestate.com (line 85) > > That’s referencing this code on index.cfm: > > > > <script type="text/javascript"> > > > > $(document).ready(function(){ > > > > $('#photoMontage').cycle({ > > fx: 'fade', > > speed: > 2000, > > timeout: > 6000 > > }); > > }); > > > > > > > > Again, this code works fine in FF and did in IE when I first wrote the code > > and created the site. > > > > The HTML looks like this for the photos cycling: > > > > > > > > > width="860" height="425" /> > > width="860" height="425" /> > > width="860" height="425" /> > > > > > > > > In IE, the first photo above shows, then nothing else happens except the > error > > message in the lower right corner of the browser window. > > > > Anyone know of anything that could be happening to cause this? > > > > Thanks, > > > > Rick > > > > * > --- > * > > *"Those who hammer their guns into plows will plow for those who do not." > - Thomas Jefferson* > > > > >
Re: [jQuery] Why would jQuery be undefined in IE, but not FF???
Well, the most obvious idea that's coming to my mind would be to check wether your jQuery loader line comes before the plugin's loading line. If not, the code of the plugin, which requires jQuery, will lack jQuery and fail. Michel Belleville 2009/11/20 Rick Faircloth <r...@whitestonemedia.com> > Even stranger… > > > > I went back to another site where I have the cycle plug-in successfully > running > > on IE and FF to retrieve the versions of jquery core and cycle plug-in that > are working. > > > > I put those into the site at www.holtzmanrealestate.com and I get the same > problem > > as before… > > > > ‘jQuery’ is undefined (line 10 of jquery.cycle.2.03.pack.js) > > and > ‘jQuery’ is undefined (line 90 www.holtzmanrealestate.com, which refers to > the > > cycle plug-in script as defined below.) > > > > What could possibly be the issue? > > > > Rick > > > > *From:* Rick Faircloth [<a rel="nofollow" href="mailto:r...@whitestonemedia.com">mailto:r...@whitestonemedia.com</a>] > *Sent:* Friday, November 20, 2009 11:36 AM > *To:* jquery-en@googlegroups.com > *Subject:* [jQuery] Why would jQuery be undefined in IE, but not FF??? > > > > Hi, all… > > > > Anyone have any idea about this? First time I’ve seen it… > > > > I using Mike Alsup’s cycle plug-in to cross fade three photos. > > When I first set this up, it worked fine in IE and FF. > > > > Now, however, the code only works in FF. IE7 & IE8 (at a minimum), > > return the error messages: > > > > ‘jQuery’ is undefined > > jquery.cycle.all.2.65.min.js (line 16) > > > > Line 16 refers to the first line of code in jquery.cycle.all.2.65.min.js, > that starts: > > ;(function($){var > ver="2.65";if($.support==undefined){$.support={opacity:!($.browser.msie)};}function > log(){if(window.console&&window.console.log){ etc… > > > > The next error message returned by IE is: > > ‘jQuery’ is undefined > > www.holtzmanrealestate.com (line 85) > > That’s referencing this code on index.cfm: > > > > <script type="text/javascript"> > > > > $(document).ready(function(){ > > > > $('#photoMontage').cycle({ > > fx: 'fade', > > speed: > 2000, > > timeout: > 6000 > > }); > > }); > > > > > > > > Again, this code works fine in FF and did in IE when I first wrote the code > > and created the site. > > > > The HTML looks like this for the photos cycling: > > > > > > > > > width="860" height="425" /> > > width="860" height="425" /> > > width="860" height="425" /> > > > > > > > > In IE, the first photo above shows, then nothing else happens except the > error > > message in the lower right corner of the browser window. > > > > Anyone know of anything that could be happening to cause this? > > > > Thanks, > > > > Rick > > > > * > --- > * > > *"Those who hammer their guns into plows will plow for those who do not." > - Thomas Jefferson* > > >
Re: [jQuery] Re: IE loops while infinite (jQuery). Firefox works fine. Anyone can help fixing script for IE?
2009/11/19 hagbardceline > @Michel > > Yes, basically you're totally right. Your script is much nicer and > does not nest loops. > Logic is not exactly as it should be. > > The idea is: > > After each closing h3 tag () inside modAccordion container append > an opening div () tag. > Before every opening h3 tag () but not before the first opening h3 > tag add a closing div () tag. > Finally before the closing div tag from the modAccordion container, > add a closing div () tag. > Isn't it what my script does precisely ? $(".modAccordion > h3").each(function() { var switch = true; $(this).nextAll() .select(function() { return switch && (switch = ! $(this).is('h3')); }) .wrapAll(''); }); line 1 : round all h3 in .modAccordion and for each line 3 : | select all next elements line 4 : | | pick those of these elements that are just before the next h3 (the resulting selection is placed between current h3's closing tag and next h3's opening tag) line 5 : | | wrap all these elements in one and the same div with class="new" (between current h3 and next h3 according to line 4) > But you got me close! > Thanx anyway, I appreciate your help. > > As long as you're close that's fine by me anyway. Kind regards. Michel Belleville
Re: [jQuery] where to start ajax learinig
So, you may find informations about what AJAX means here : http://en.wikipedia.org/wiki/AJAX In shorts it's a way to use JavaScript client-side to query a server for small bits and act upon it changing part of the page instead of just loading whole pages each time the client has to interact with the server. As for a framework it's basically a set of tools that helps you writing your own code in a specific context. For example an AJAX framework will help you writing AJAX code. Now really for questions that broad, you should do some reasearches on your own (google is your friend) before asking in a mailing list. Michel Belleville 2009/11/19 Ankur_Patel > > *framework > > On Thu, Nov 19, 2009 at 2:36 PM, Ankur_Patel wrote: > >> can you tell me what is ajax freame work and how to work and how implemetn >> our code like Gmail,yahoo,facebook >> >> >> thanx Michel Belleville >> >> thanx All of memebers of this community >> >> >> On Wed, Nov 18, 2009 at 3:25 PM, Michel Belleville < >> michel.bellevi...@gmail.com> wrote: >> >>> You can start here : >>> http://docs.jquery.com/Ajax >>> >>> There's good reading in the documentation. >>> >>> Michel Belleville >>> >>> >>> 2009/11/18 Ankur_Patel >>> >>> Hello, >>>> can u tell me where to start ajax. i am new learner of ajax. i know just >>>> simple creation of request object. proceduers,events and properties of >>>> request object. >>>> >>>> tell me where to start ajax how to use of ajax like gmail,yahoo also >>>> facebook. >>>> >>>> >>>> >>>> thanx >>>> >>> >>> >> >
Re: [jQuery] IE loops while infinite (jQuery). Firefox works fine. Anyone can help fixing script for IE?
If I may be so bold, perhaps you'd be better off using iterators and avoid nesting while loops based on the same numeric condition. For exemple, let's imagine I'd like to round up all h3 nodes and their immediate following siblings in neat s here's what I'd do : $(".modAccordion > h3").each(function() { var switch = true; // will be used in the select iteration to stop the selection when reaching the next h3 element $(this).nextAll() // selects all the next siblings .select(function() { return switch && (switch = ! $(this).is('h3')); }) // stops the selection when the next h3 is reached .wrapAll(''); // wrap all remaining (the immediate next siblings before encountering the next h3) in a div with class="new" }); This should be less messy than nested whiles, while doing the same thing if I read your method right. Michel Belleville 2009/11/19 hagbardceline > I have the following script (see below), which dynamically adds div > between closing and opening h3 tags. > The script works fine in Firefox but IE is infinite looping the first > while. > > Does anyone have an idea how to fix the script for IE? > > Thx! > hagbard > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > http://www.w3.org/1999/xhtml"; xml:lang="en-us"> > > > > src="<a rel="nofollow" href="http://tablesorter.com/jquery-latest.js"">http://tablesorter.com/jquery-latest.js"</a>;> > > > jQuery(function(){ > > var nodes = new Array(); > nodes = $(".modAccordion").children(); > $(".modAccordion").children().remove(); > > var i = 0; > var headerTest = /.(Head)./; > > while(i < nodes.length) > { > var testNode = nodes[i].toString(); > > if((testNode.match(headerTest))){ > $(".modAccordion").append(nodes[i]); > i++; > > var newDiv = document.createElement("div"); > newDiv.className="new"; > > while(i < nodes.length && !((nodes[i].toString()).match > (headerTest))) > { >newDiv.appendChild(nodes[i]); >i++; > } > $(".modAccordion").append(newDiv); > } > > } > > }); > > > > div.new > { > background: #00ff00; > > } > > .modAccordion > { > background: #ff; > > } > > > TableSorter > > > > header 1 > some text > some other text > header 2 > some text > > list element 1 > list element 2 > > header 3 > some text > some other text > some more text > some different text > > > >
Re: [jQuery] Need help in making AJAX call in IE8
$.post() won't work on a local file either. Local or distant you have to talk to a web server, tapping the local file system won't work, and that's a feature. Michel Belleville 2009/11/18 Denis Caggiano > When I need to use ajax in my applications I implement the $.post and > never had problems. > Try to use this. >
Re: [jQuery] i need help on jquery ^^
Well, it's not usual to see a job offer on jQuery's mailing list. What do you offer mate (beside your undying friendship) ? Michel Belleville 2009/11/18 kramnavi > > > im trying to hide and show the images with a plus sign separating the > images to each other. onclick on the checkbox the image and the plus > sign will hide/show. > > > image1 + image2 + image3 > > checkbox1 > > checkbox2 > > checkbox3 > > > > onclick at the checkbox1 the image1 and "+" will hide/show same action > goes to other checkboxes, my problem is that how to hide/show the plus > sign "+" if i click on the checkbox3 or if i click on the checkbox2 > which of the plus sign will hide/show. > > > can you please create a jquery script for me? > > > > >
Re: [jQuery] Need help in making AJAX call in IE8
AJAX calls does not work with local documents, I'll let you guess why (hint : what if I decided to read what's in your local files using my webpage, then send it to a database of mine so I can log into your favorite forum, online game, internet order site, webmail, etc. just for the fun of it... or not). Michel Belleville 2009/11/18 santosh chavan > HI All > > I am trying to load XML file using following code. > $(document).ready(function() { > $.ajax({ >type: "GET", >url: "D:\Documents and > Settings\santosh.chavan\Desktop\ajaxJqueryXML > \data.xml", >dataType: "xml", >success: function(xml) { >alert(xml); >} >}); > }); > > This code is returning me object if i configured this page in IIS. > > If i load this page from local drive, its not returning me xml object. > > same code return me object in firefox on local drive. > > please guide for same. > > > >
Re: [jQuery] where to start ajax learinig
You can start here : http://docs.jquery.com/Ajax There's good reading in the documentation. Michel Belleville 2009/11/18 Ankur_Patel > Hello, > can u tell me where to start ajax. i am new learner of ajax. i know just > simple creation of request object. proceduers,events and properties of > request object. > > tell me where to start ajax how to use of ajax like gmail,yahoo also > facebook. > > > > thanx >
Re: [jQuery] Re: IE 7 error with $.getJSON data elements
2009/11/17 Michael Geary > No, the scope of the data parameter is not the problem. The data parameter > is already in scope inside your click handler. (Michel, check the code > carefully - don't you agree? The click handler is nested inside the getJSON > callback.) > Apparently. Indenting is such a good habit though... Michel Belleville
Re: [jQuery] Re: IE 7 error with $.getJSON data elements
Well, you can call the click method inside the getJSON callback, that's the most straightforward way to do it, and probably the cleanest. Michel Belleville 2009/11/17 roryreiff > So I guess that is the problem then? How would I work towards a > solution in making 'data' available to that .click() function? > > On Nov 17, 10:02 am, Michel Belleville > wrote: > > Oh, yeah, now I see. > > > > Of course data is probably not what you expect where you're reading it. > Why > > would it ? It's set in a callback as a function's parameter, it's not > meant > > to get out of the callback's scope, and even when it would, you don't > know > > when the callback is triggered, that can be right before, right after, a > > month after, never, depending on how the AJAX call ends. > > > > Michel Belleville > > > > 2009/11/17 roryreiff > > > > > Could it have something to do with the 'data' variable not being > > > available to the function that I have placed inside the $.getJSON > > > call? Is there a way to force it to pass on/be available to my > > > ppButton.click(...) function? This is all I can think of for now. >
Re: [jQuery] Re: IE 7 error with $.getJSON data elements
Oh, yeah, now I see. Of course data is probably not what you expect where you're reading it. Why would it ? It's set in a callback as a function's parameter, it's not meant to get out of the callback's scope, and even when it would, you don't know when the callback is triggered, that can be right before, right after, a month after, never, depending on how the AJAX call ends. Michel Belleville 2009/11/17 roryreiff > Could it have something to do with the 'data' variable not being > available to the function that I have placed inside the $.getJSON > call? Is there a way to force it to pass on/be available to my > ppButton.click(...) function? This is all I can think of for now. > >
Re: [jQuery] IE 7 error with $.getJSON data elements
Well, when I've got an error saying something is null or not an object, and that very something is obtained from a query response, first thing I do is checking what was the response. Firebug may help if you're not using it already, and my shot in the dark here would be to think you've either received something you didn't expect, or in a format you didn't exepct, or that the data.items[0].background didn't fit the provided format. Michel Belleville 2009/11/17 roryreiff > //This code is withing a larger function, but the error is coming into > play when the 'ppButton' is clicked > // It throws the following error in IE 7 (6 not yet tested): > // > // Error: 'data.items[...].background' is null or not an object > // Code: 0 > // > > var PP = $('.pomonaPeople'); > > $.getJSON("/dev/home/pp.json", >function(data){ >PP.css('background', 'url(' + data.items[0].background + > ' )' ); > >// create navigation >var ppButton = $('#pp-nav ul li a'); >ppButton.qtip({ style: { name: 'pomonastandard', 'font- > size': '70%', tip: true }, position: { adjust: { mouse: true, x:0, y: > 0, screen: true }, corner: { target: 'topRight', tooltip: > 'bottomLeft'}} }); >var currentPP = PP.find('#pp-0'); > >ppButton.click( function(event) { > event.preventDefault(); > var ppDivs = PP.children('div'); > var aIndex = $(this).attr('href'); > var destination = PP; > destination.append(''); > var aIndexBG = data.items[aIndex].background; > destination.css('background', 'url(' + aIndexBG + > ' )' ); > // set z-index of current div to be above others, and > reset rest > currentPP.css('z-index', '100'); > currentPP = $('#pp-' + aIndex); > //console.log(currentPP); > currentPP.css('z-index', '125'); > destination.find('.loading').fadeOut(FADE); >}); > >PP.find('.loading').fadeOut(FADE); > >}); >
Re: [jQuery] Basic selectors question
Consider this setting : $('blah + *') will select $('bloh ~ *') will select Michel Belleville 2009/11/17 HB > Hey, > I started learning JQuery today. > I got what (E>F) selector does but I didn't digest what (E+F) and > (E~F) do. > Thanks for help and time. >
Re: [jQuery] Syntax Question
It would help if your function was ready to receive this additional parameter wouldn't it ? var init_number_of_bikes = function(chosen_id) { ... }; Then you could use the value. If someone calls the function and gives no value, it'll be empty (empty is false when used as a boolean in JavaScript). Michel Belleville 2009/11/17 heohni > Hi, > > I have build a function like this: > > var init_number_of_bikes = function(){ >// Request all avail. bikes >var urlextend = findBikes(); >$.ajax({ >type: "get", >url: > "./includes/ajax.php?action=getBikes"+urlextend, >success: function(msg){ >//alert(msg); >$('.nrBikes').html(msg) >} >}); >} > > And I am calling this funtion on several places. > Now I came to the point, where I want to pass an addtional value to > this function, like > > init_number_of_bikes(chosen_id); > > But how can I access this passed value within my function? >
Re: [jQuery] Re: simeple drop down menu
According to http://docs.jquery.com/Effects/stop you'd better use stop this way : .stop(true, true). Your problem was the animation could be stopped halfway through the fadeIn and keep an opacity value way too transparent to let the element appear again next time you tried to fade it in again. Michel Belleville 2009/11/17 runrunforest > THanks Michel, changed the selector slightly, it works. But only half. > > The problem now, if i hover in and out multiple times the list will > disappear permanently. > > http://ajax.googleapis.com/ajax/</a> > libs/jquery/1.3.2/jquery.min.js<<a rel="nofollow" href="http://ajax.googleapis.com/ajax/%0Alibs/jquery/1.3.2/jquery.min.js">http://ajax.googleapis.com/ajax/%0Alibs/jquery/1.3.2/jquery.min.js</a>> > "> > > $(function(){ > $('div').hover(function(){ >$(this).children('ul').stop().fadeIn(333); > }, function(){$('.news').children('ul').stop().fadeOut(333); >}); > }); > > > > >NEWS> > >Real Estate >Your Home >Real Estate >Your Home > > >
Re: [jQuery] simeple drop down menu
Well, that's just what you're asking here, when you hover in you fade in, when you hover out you fade out. Maybe you should give the hover method the div instead, so when you hover in the ul you're still hovering in the div. Michel Belleville 2009/11/17 runrunforest > Hello Jquery, > > I'm making a simple 1lvl dropdown menu. So far this is what i've got. > The problem is, I hover the link the ul shows, but i can't hover the > list item, they disappears as long as i mouseout the main link. > > http://ajax.googleapis.com/ajax/</a> > libs/jquery/1.3.2/jquery.min.js<<a rel="nofollow" href="http://ajax.googleapis.com/ajax/%0Alibs/jquery/1.3.2/jquery.min.js">http://ajax.googleapis.com/ajax/%0Alibs/jquery/1.3.2/jquery.min.js</a>> > "> > > $(function(){ >$('a').hover(function(){ >$('.news').children('ul').stop().fadeIn(333); >}, function(){$('.news').children('ul').stop().fadeOut(333); >}); > }); > > > >NEWS> > >Real Estate >Your Home >Real Estate >Your Home > > >
Re: [jQuery] jQuery and jCorner problems ($ is not a function)
What's between the tags and the <script> tag containing your own code ?... Michel Belleville 2009/11/17 ReynierPM <rper...@uci.cu> > Hi every: > I'm trying to use jCorner to get rounded effects in some of my DIV but when > I run the page nothing happen and I get this error: > > $ is not a function > [Break on this error] $().ready(function(){\n > > I've included jQuery and jCorner libraries as follow: > <script src="jquery.js" type="text/javascript"> > > > And then my code is this: > > $().ready(function(){ >$('#login').corner("bl"); >$('#container').corner(); > }); > > > Where it fails? What's wrong? > Cheers and thanks in advance >
Re: [jQuery] Re: Change all CSS background images url
Well, the other option would be once the page is loaded to round all elements of your page, pick the ones with a background-image and regexp them to submission. I'd advise against this solution though, on the grounds that : - it's not really simpler than adding a background-image correcting stylesheet - there'd be images flickering while loading - if you've got AJAX (and with CakePHP I bet you do have AJAX) you'll have to trigger that after every AJAX call On the other hand, having an alternate css turning up only on this part of the site would be really easy, you can even use it with the standard stylesheet and only change background-image properties as long as the targets are the same as in the standard sheet and you put the link to the alternate stylesheet after the standard. Michel Belleville 2009/11/16 nomen > Hi: > > Liam: My client needs to have the posibility to change itself the > image path and he is not a programmer, The maximun complication should > be to change a text by another text. Anyway I know it is a posibility > and I have it in mind. > Michel: I try to use the base tag but I´m using CakePHP and it > automatically puts in the links generathed by the HTML helper, the > subdirectory name. So it does not work correctly with those links > because the created links should be "www.domain.com/subdir/subdir/img/ > one.jpg <http://www.domain.com/subdir/subdir/img/%0Aone.jpg>". > > Thank you anyway for your help. > > > > On 16 nov, 18:03, Michel Belleville > wrote: > > First idea that comes to mind is to let your client define another site > > base, you then don't even have to change your css as the apparent site > base > > would be the client's sub-directory. > > You do that using the tag as shown here : > http://www.w3schools.com/TAGS/tag_base.asp > > > > Hope it helps. > > > > Michel Belleville > > > > 2009/11/16 nomen > > > > > Hi all: > > > > >I have a website. All my images are in "/img" directory. > > >Now, my client needs to put the site in a subdirectory, so, my > > > images are now in "/subdir/img". > > >In the future, maybe we have to change the site to another > > > subdirectory. > > >I don´t want to change all my CSS anytime the client changes the > > > subdirectory. > > >So my question is: > > >Is there a simple way to change all CSS background-image > > > property with the next logic: > > > > > "Change all the existing CSS background-image > > > properties in this way: > > > if the url starts with "/img" change to "/subdir/ > > > img" else do nothing" > > > > > Thank you for your help in advance. >
Re: [jQuery] Change all CSS background images url
First idea that comes to mind is to let your client define another site base, you then don't even have to change your css as the apparent site base would be the client's sub-directory. You do that using the tag as shown here : http://www.w3schools.com/TAGS/tag_base.asp Hope it helps. Michel Belleville 2009/11/16 nomen > Hi all: > >I have a website. All my images are in "/img" directory. >Now, my client needs to put the site in a subdirectory, so, my > images are now in "/subdir/img". >In the future, maybe we have to change the site to another > subdirectory. >I don´t want to change all my CSS anytime the client changes the > subdirectory. >So my question is: >Is there a simple way to change all CSS background-image > property with the next logic: > > "Change all the existing CSS background-image > properties in this way: > if the url starts with "/img" change to "/subdir/ > img" else do nothing" > > Thank you for your help in advance. > >
Re: [jQuery] Re: DOM changes takes effects only after function is done processing
Well, if you're aware of the side-effects, that's fine by me. Still it's a bit like using an h-bomb to treat cancer patients, sure it's likely to cure it 100% of the times, as long as you don't mind your patient dying in the process. Michel Belleville 2009/11/16 nowotny > On 16 Lis, 11:40, Michel Belleville > wrote: > > Well for a start I wouldn't use a this kind of pause() trick if I were > you, > > it's pretty brutal suff looping along until time has passed will likely > > freeze your interface and that's a bad thing. > Like I said... it's only a stand in for the ajax call that'll replace > it in the end... the thing is I have to test if on the IP and port the > user specified there is a certain service running and if a user puts > in an invalid IP (where the service is not running) the ajax call > takes some time (until timeout) to process... during that time the > interface is frozen and I want it to be... I just want it to show that > it's testing the connection and I thought putting "Testing" into DOM > before doing the ajax call would inform the user what's happening but > it's not being changed until after the whole function finishes > processing when it's already to late cause I already have the results > of the ajax call... > > > You'd probably be better off > > with a setTimeout() which would delegate exécution of a callback after > the > > time, thus truely imitating an Asynchronous call. > Again, I said I want to do a synchronous ajax call... and I don't need > to delay anything so setTimeout() is not needed here... > > -- > nowotny >
Re: [jQuery] DOM changes takes effects only after function is done processing
Well for a start I wouldn't use a this kind of pause() trick if I were you, it's pretty brutal suff looping along until time has passed will likely freeze your interface and that's a bad thing. You'd probably be better off with a setTimeout() which would delegate exécution of a callback after the time, thus truely imitating an Asynchronous call. Michel Belleville 2009/11/16 nowotny > Hello. > At first I want to say I know it's not strictly jQuery issue but there > are many Javascript skilled people here that may know best so I hope > you forgive me... ;) > > Ok, so here's a problem: I have a following function in which I change > some DOM elements: > function ttt(){ > $('#test').html('Testing...'); > pause(3000); > } > > function pause(milliseconds) { > var dt = new Date(); > while ((new Date()) - dt <= milliseconds) { /* Do nothing */ } > } > > (The pause function is there to simulate ajax synchronous call that > can sometimes slow down the execution) > The problem is that the DOM changes takes effect only after the > function has finished processing, that is, it pauses for 3 seconds and > only then changes the DOM... Is that a standard Javascript > functionality...? > > I want to do something like this: > function ttt(){ > $('#test').html('Testing...'); > pause(3000); // here I make an ajax call $.ajax(...) > if(ajax_call_succesfull) $('#test').html('Success.'); > else $('#test').html('Error.'); > } > but the 'Testing...' does not show up immediately... Instead it waits > until the ajax call is finished and then I don't need it any more... > So is there any way to make it work like I would like it to...? I'm > open to any suggestions... > > -- > nowotny >
Re: [jQuery] Remove a tab that contains some element
Bits of code would definetly help to put you on the right tracks. Can you show a little html plz ? Michel Belleville 2009/11/13 cPetru > Hello > > I created some tabs dinamically and now I need to remove one, > triggered by an element inside a tab (not tab-header, not the > currently selected tab). > I can not find a way to determine the index of the tab that contains a > particular element (let's say table#Streets). > > Thank you very much. >
Re: [jQuery] Sum up of selected classes
I thought it was more on the lines of $(".total").val(tot) considering he said the input had the class "total". Michel Belleville 2009/11/13 Dan G. Switzer, II > palgo: > > You probably mean: > > $("#total").val(tot); > > The selector $("total") would be looking for an element named total (i.e. > ,) where as $("#total") looks for an element with an id of "total". > > -Dan > > On Fri, Nov 13, 2009 at 10:13 AM, palgo wrote: > >> Hi guys, >> >> I have several input fields where the value get set (gave them class >> name ="part"). >> I want to sum up the input values into a last input field with class = >> "total", whenever something is being typed in some other fields. >> >> The input fields with class "part" is not a fixed amount, they can >> vary between 2 to infinite. >> >> So I tried this, which doesn't work: >> >> $(".whatever").live("keyup", function(event){ >> >>var arr = $(".part"); >>var len = arr.length; >>var tot = 0; >> >>while (i>{ >> >>tot = tot +arr[i].val(); >>i--; >>} >> >> $("total").val(tot); >> >>}); >> >> Anyone know what I'm doing wrong? >> >> >> >
Re: [jQuery] Sum up of selected classes
While is a bad habit you may love to leave when you try the iterator approach : var tot = 0; $('.part').each(function() { tot += $(this).val(); }); $('.total').val(tot); And don't forget classes are accessed with a '.' (total lacked it's '.' in your example). Michel Belleville 2009/11/13 palgo > Hi guys, > > I have several input fields where the value get set (gave them class > name ="part"). > I want to sum up the input values into a last input field with class = > "total", whenever something is being typed in some other fields. > > The input fields with class "part" is not a fixed amount, they can > vary between 2 to infinite. > > So I tried this, which doesn't work: > > $(".whatever").live("keyup", function(event){ > >var arr = $(".part"); >var len = arr.length; >var tot = 0; > >while (i{ > >tot = tot +arr[i].val(); >i--; >} > > $("total").val(tot); > >}); > > Anyone know what I'm doing wrong? > > >
Re: [jQuery] Anyone work with jquery FLOT that can help me please?
I'm not, but I'm sure you'll get more help sooner if you actually post a question. Michel Belleville 2009/11/13 jackkit...@gmail.com > Hi, looking for someone that might be a guru with jquery flot? > > > Thanks >
Re: [jQuery] Re: css based on url wildcard
Hey Jacques, Here's how you make a regexp that looks for "BlogRetrieve.aspx" in a string : /BlogRetrieve.aspx/ or new RegExp('BlogRetrieve.aspx') Now here's how you check wether a string matches with a regexp : "blah blah blah".match(/blah/) Here's a good site to learn about regexp (which are very popular amongst developers on many languages for some reason), there's a part about JavaScript : http://www.regular-expressions.info/ I hope it helps you to learn, I'll let you putting the pieces together (which basically means writing an if using the regexp to condition execution of .addClass() ). Michel Belleville 2009/11/13 Wacko Jacko > Hi Michael, > > Thanks so much for taking the time to reply. I have very limited > Javascript knowledge (learning). Are you able to offer any more clues > to get me on track? > > Thanks in advance for your help!. > > Jack > > On Nov 9, 4:32 pm, Michel Belleville > wrote: > > Straight js : window.location.url contains current url. > > jQuery : $('#id_of_element').addClass('class') selects and element with > the > > id 'id_of_element' and adds the class 'class'. > > I'll let you add the if and write the regexp (straight JS). > > > > Michel Belleville > > > > 2009/11/9 Wacko Jacko > > > > > Hi All, > > > > > Just wondering if there is a way with jQuery of adding css to an id > > > based on a url wildcard? Eg, if the current url contains > > > 'BlogRetrieve.aspx' add .class to this #id. > > > > > Thanks in advance for your help. > > > > > Jackson >
Re: [jQuery] Getting a position and setting a absolute position relatively
http://docs.jquery.com/CSS/offset http://docs.jquery.com/CSS/css#namevalue Michel Belleville 2009/11/12 Atkinson, Sarah > I want to find the x,y position of an element on the page and then set > the xy position of another element relative to the first one. How do I do > this? >
Re: [jQuery] jquery tabs not on the same row! help please!
Floats are a pain as soon as you try to use proper positionning (relative / absolute) along with proper overflow. Floats should be used to place content alongside inline content to make said content flow around the floating element, adapting to its shape. It's perfect for, say, inserting a visual illustration within the paragraph it illustrates, and can be used in various hacks to keep a text-free zone to dress an element around some background-image decoration. What it shouldn't be used for however is replacing inline-block, because contrary to inline-blocks, floating elements aren't placed inside the inline flow but in the twilight-zone-ish floating flow. This means floating elements won't behave like real blocks nor real inline. For exemple they won't be taken in account by their block parent when it comes to deciding it's size, or for overflow (which causes various *nasty* "I scroll the div but the flows don't move" or "why the fuzz aren't they wrapping" bugs in various implementations of IE), and positioning elements inside can be a pain (try it, you probably won't like it). On the other hand, inline-block is exactly the way an behaves plus the advantages of proper positionning and reserving space as one should, and as far as IE is concerned it works great using a little initial and non-intrusive hack to make it IE7 compliant (I'm not too sure about IE6, but hey, it's already officially made obsolete by its maker...). Plus it's the standard way to do things, so sooner or later IE will make a gre... a goo... a job of it. Hope it helps. Michel Belleville 2009/11/12 Andrei Eftimie > Sorry for thread-hijacking, but why would you say that floats are > complicated? > > Right now (as in current browser implementations) floats work really > reliably. > (with 1 small IE bug with an easy fix) > > inline-block needs to be hacked in multiple browsers > > 2009/11/12 Michel Belleville : > > Also, you'd better not use floating positioning (easier on the very short > > term, a lot more complicated in mid-long term). > > > > Michel Belleville > > > > > > 2009/11/12 Andrei Eftimie > >> > >> This is a CSS issue, not really related to jQuery. > >> > >> Do something like this in your CSS file: > >> > >> /* Forcing the ul to take not of its floated children. */ > >> #tabs ul { display: inline-block; overflow: hidden; } > >> #tabs ul { display: block; } > >> > >> /* Floating the children */ > >> #tabs li { float: left; } > >> > >> > >> 2009/11/12 AdyLim : > >> > Hi there, > >> > > >> > I'm just starting to learn jquery and trying to implement tabs onto my > >> > aspx page...The problem is that the tabs are showing up one on top of > >> > anotherhow do i get the tabs to line up in a row? I'm using > >> > jquery 1.2.6...all the js's (ui.core.js, ui.tabs.js) are included in > >> > my masterpage. > >> > > >> > any help is appreciated! > >> > thanks! > >> > > >> > my code follows: > >> > > >> > ASPX: > >> > > >> > <%@ Page Title="" Language="C#" MasterPageFile="~/Master.Master" > >> > AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" > >> > Inherits="ctc3.test.WebForm1" %> > >> > > >> > > >> > >> > runat="server"> > >> > > >> > >> > runat="server"> > >> > > >> > > >> > > >> > $(function() { > >> > $("#tabs").tabs(); > >> > }); > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> >Nunc tincidunt > >> >Proin dolor > >> >Aenean lacinia > >> > > >> > > >> > > >> >Proin elit arcu, rutrum commodo, vehicula tempus, commodo > >> > a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. > >> > Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. > >> > Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. > >> > Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam > >> > sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. > >> >
Re: [jQuery] Re: Are there any specific reason why the Jquery library returns a lot of errors in the Firefoxx error console?
2009/11/12 MorningZ > you could go through the CSS > and remove every IE specific declaration, but now you'd have to > support two copies of the file, one for IE, one for everyone else. > > If only 2 copies were enough here... More like 2+ copies depending on how many versions of IE you wish to support (although I never in my whole professional life wished I'd support IE ; anyway I wished IE would support a lot of things, so I guess that counts in a weird way). Michel Belleville
Re: [jQuery] jquery tabs not on the same row! help please!
Also, you'd better not use floating positioning (easier on the very short term, a lot more complicated in mid-long term). Michel Belleville 2009/11/12 Andrei Eftimie > This is a CSS issue, not really related to jQuery. > > Do something like this in your CSS file: > > /* Forcing the ul to take not of its floated children. */ > #tabs ul { display: inline-block; overflow: hidden; } > #tabs ul { display: block; } > > /* Floating the children */ > #tabs li { float: left; } > > > 2009/11/12 AdyLim : > > Hi there, > > > > I'm just starting to learn jquery and trying to implement tabs onto my > > aspx page...The problem is that the tabs are showing up one on top of > > anotherhow do i get the tabs to line up in a row? I'm using > > jquery 1.2.6...all the js's (ui.core.js, ui.tabs.js) are included in > > my masterpage. > > > > any help is appreciated! > > thanks! > > > > my code follows: > > > > ASPX: > > > > <%@ Page Title="" Language="C#" MasterPageFile="~/Master.Master" > > AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" > > Inherits="ctc3.test.WebForm1" %> > > > > > > > runat="server"> > > > > > runat="server"> > > > > > > > > $(function() { > > $("#tabs").tabs(); > > }); > > > > > > > > > > > > > > > >Nunc tincidunt > >Proin dolor > >Aenean lacinia > > > > > > > >Proin elit arcu, rutrum commodo, vehicula tempus, commodo > > a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. > > Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. > > Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. > > Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam > > sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. > > Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci > > tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus. > > > > > >Morbi tincidunt, dui sit amet facilisis feugiat, odio > metus > > gravida ante, ut pharetra massa metus id nunc. Duis scelerisque > > molestie turpis. Sed fringilla, massa eget luctus malesuada, metus > > eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet > > fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. > > Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. > > Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra > > nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas > > feugiat, tellus pellentesque pretium posuere, felis lorem euismod > > felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et > > purus. > > > > > >Mauris eleifend est et turpis. Duis id erat. > Suspendisse potenti. > > Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, > > eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent > > taciti sociosqu ad litora torquent per conubia nostra, per inceptos > > himenaeos. Fusce sodales. Quisque eu urna vel enim commodo > > pellentesque. Praesent eu risus hendrerit ligula tempus pretium. > > Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus. > >Duis cursus. Maecenas ligula eros, blandit nec, > pharetra at, > > semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra > > justo vitae neque. Praesent blandit adipiscing velit. Suspendisse > > potenti. Donec mattis, pede vel pharetra blandit, magna ligula > > faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. > > Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi > > lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean > > vehicula velit eu tellus interdum rutrum. Maecenas commodo. > > Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus > > hendrerit hendrerit. > > > > > > > > > > > > > > > > > > > > -- > Andrei Eftimie > http://eftimie.com > +40 758 833 281 > > Punct > http://designpunct.ro >
Re: [jQuery] jquery tabs not on the same row! help please!
This is a css question rather than jQuery, though the answer goes as follow : 1. you're using an ul with li inside 2. ul work as block elements containing li which are block elements too 3. block elements pile up on top of one another unless told otherwise What you need is made them act as inline, the best way (a bit harder in the short term, a lot easier in the long term) is to use inline-block positioning, and hack IE (remember, no matter what you do in css, you'll probably have to hack IE). This may help : http://homepage.ntlworld.com/spartanicus/ie_block_level_element_inline-block_hack.htm Michel Belleville 2009/11/12 AdyLim > Hi there, > > I'm just starting to learn jquery and trying to implement tabs onto my > aspx page...The problem is that the tabs are showing up one on top of > anotherhow do i get the tabs to line up in a row? I'm using > jquery 1.2.6...all the js's (ui.core.js, ui.tabs.js) are included in > my masterpage. > > any help is appreciated! > thanks! > > my code follows: > > ASPX: > > <%@ Page Title="" Language="C#" MasterPageFile="~/Master.Master" > AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" > Inherits="ctc3.test.WebForm1" %> > > > runat="server"> > > runat="server"> > > > > $(function() { > $("#tabs").tabs(); > }); > > > > > > > >Nunc tincidunt >Proin dolor >Aenean lacinia > > > >Proin elit arcu, rutrum commodo, vehicula tempus, commodo > a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. > Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. > Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. > Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam > sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. > Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci > tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus. > > >Morbi tincidunt, dui sit amet facilisis feugiat, odio > metus > gravida ante, ut pharetra massa metus id nunc. Duis scelerisque > molestie turpis. Sed fringilla, massa eget luctus malesuada, metus > eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet > fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. > Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. > Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra > nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas > feugiat, tellus pellentesque pretium posuere, felis lorem euismod > felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et > purus. > > >Mauris eleifend est et turpis. Duis id erat. Suspendisse > potenti. > Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, > eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent > taciti sociosqu ad litora torquent per conubia nostra, per inceptos > himenaeos. Fusce sodales. Quisque eu urna vel enim commodo > pellentesque. Praesent eu risus hendrerit ligula tempus pretium. > Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus. >Duis cursus. Maecenas ligula eros, blandit nec, pharetra > at, > semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra > justo vitae neque. Praesent blandit adipiscing velit. Suspendisse > potenti. Donec mattis, pede vel pharetra blandit, magna ligula > faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. > Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi > lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean > vehicula velit eu tellus interdum rutrum. Maecenas commodo. > Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus > hendrerit hendrerit. > > > > > > > >
Re: [jQuery] Re: Load image with an ajax preloader?
You may also like this nifty little trick : $('#myImage').attr('src', 'image.jpg').load(function() { alert( 'Image Loaded'); }); Apparently images does use the .load() event callback. Michel Belleville 2009/11/10 Michel Belleville > This is straight JS, I never used it before and I'm not sure how > cross-browser it is but this should help : > http://talideon.com/weblog/2005/02/detecting-broken-images-js.cfm > > Michel Belleville > > > 2009/11/10 123gotoandplay > > Hi michel, >> >> Tx for the explanation, i am trying your suggestion and it indeed >> works like a charm. >> >> At the moment i am updating div imagePreview depending on a combo of >> select menu options. >> >> As i understand it the ajax-loader.gif keeps on spinning in the >> background. >> Is there a way to check if the image is really loaded and if not >> display another image as background saying "no image found". >> >> working code at the moment >>$("#size_update").change(function(){ >>var srcSize = $("option:selected", this).val(); >>var srcColor = $("#color_update option:selected").text(); >>var imgSrc = srcColor+"-"+srcSize; >>$('#imagePreview').html(''); >>}); >>$("#color_update").change(function(){ >>var srcColor = $("option:selected", this).val() ; >>var srcSize = $("#size_update >> option:selected").text(); >>var imgSrc = srcColor+"-"+srcSize; >>$('#imagePreview').html('> src="'+imgSrc+'.jpg"/>'); >>}); >> >> .loading { >> background: url(ajax-loader.gif) no-repeat center center; >> } >> > >
Re: [jQuery] Re: Are there any specific reason why the Jquery library returns a lot of errors in the Firefoxx error console?
Ok, so, first of all error # warning. An error means something has gone wrong, sometimes horribly, a warning merely means something may possibly be a mistake, or not. Especially css warnings, which basically means "oh, I don't know this one" (I'd even be so bold as to add "could that be an Internet Explorer specific rule that is meant to mean nothing by me, Firefox"). But I wonder about those of your clients that are worried about that, are they the same people that use tables as a positionning system because "at least it works the same on IE and Firefox, so, hey, let's be pragmatic lad" ?... The very same that sometimes think that it's a good idea to place a link in another link, "cause, hey, we need this one clickable and this other clickable in it and we have to make it work in IE so" ?... The kind of people that, when faced with the need to place blocks in line think "well, let's do it all with floats cause that basically what float is for, don't give me any of this inline-block nonesense, the stuff's for wuss" ?... Because if they are, well, I wouldn't bother too much about their opinion on what's clean and what's not. Michel Belleville 2009/11/12 Sune42 > > Hi > > What I mean is that I get a lot of Jquery CSS errors/warnings in > Firefox error console ,like if I visit this page > http://jqueryui.com/demos/draggable/ > > I get 9 errors in the Varning: > > > http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css > > So I wonder if this is by design to have these "flaws" to make it 100% > browser compatible? > > Why I also ask is that I have clients who doesn't want to use it due > to all these warnings/errors (this is true!) > > PS, I do love Jquery by the way. >
Re: [jQuery] $(function () {...}, iframe.contentDocument);
Perhaps not, considering jQuery.ready() isn't meant to be triggered when an underlying iframe added on-the-fly after the page completed is loaded. You may be interested in investigating iframe's "load" event instead. Michel Belleville 2009/11/12 Jack Bates > I want to register a function to run when an iframe finishes loading, > or immediately if it's already loaded > > To achieve this, I tried, > > $(function () > { >var iframe = $('').appendTo('body')[0]; >$(function () > { >$('READY!').appendTo('body'); > }, iframe.contentDocument); > }); > > Unfortunately the function always runs immediately, whether the iframe > is loaded or not : ( > > e.g. > http://cgi.sfu.ca/~jdbates/tmp/jquery/20090/<http://cgi.sfu.ca/%7Ejdbates/tmp/jquery/20090/> > > Is this a bug in jQuery? or a feature request? > > May I open an issue? >
Re: [jQuery] Re: Are there any specific reason why the Jquery library returns a lot of errors in the Firefoxx error console?
Doesn't it smell a bit like a troll all of a sudden ?.. Michel Belleville
Re: [jQuery] IE Help - Code Included
I'm not sure what it is but it's obviously in the ajax callback (the delete completed). My best guess would be that chaining fadeOut() and slideUp() this way may not be a very good idea, better to use just one or the other in my opinion, though I'm not sure it's what's causing the trouble. Anyway, IE is always a pain, so... Michel Belleville 2009/11/11 Dave Maharaj :: WidePixels.com > I have a my content wrapped in a div. It has a "delete' button. Click > delete > will add the pre_delete class to the div your about to delete and a confirm > alert. Click yes and the section fades out / deleted in back-end. Click no > the div returns to normal with the pre_delete class being removed. > > In IE 7 (not tested in IE6, fine in FF, Google, Opera) if i click delete / > confirm yes the div does not fade out. when i hit refresh the record has > been deleted, its just not performing the fadeout / remove after confirm. > > Looking at thisany ideas? > > $("a.delete").live('click', function (){ > var url_id = $(this).attr("href"); > var div_id = url_id.split('/'); > var set_id = 'set_'+div_id[div_id.length-1]; > > $('#'+set_id).addClass('pre_delete'); > > if (confirm('Are you sure you want to delete the selected entry?')) { >$.ajax({ > type: "POST", > url: url_id, > success: function(){ >$('#' + set_id).fadeOut('fast').slideUp('slow', function () { >$(this).remove(); >}); > } > }); > > } else { >$('#'+set_id).removeClass('pre_delete'); > } > return false; > }); > > Thanks, > > Dave > >
Re: [jQuery] Re: sliding previous/next content
Yeah, I though someone had to have already made such a plugin. Glad you found what you needed. Michel Belleville 2009/11/11 Marco Barbosa > Hello again! > > I've found this plugin that does exactly what I needed: > Cycle plugin - http://www.malsup.com/jquery/cycle/ > > You just set a container with a fixed size and overflow hidden. > The plugin does all the rest, pretty neat! > > Just in case someone else runs into this post. > > Thanks for your slide() clarification :) > > ~ Marco Barbosa > > On 10 Nov, 20:04, Marco Barbosa wrote: > > Hi Michel! > > > > Thanks for the reply! > > > > Not sure if there are plugins to simply slide up/down. > > > > I already tried with positioning instead of display:none , but using > > slideUp and slideDown. > > It almost worked but I couldn't figure it out what was missing. The > > last ul wouldn't show up. > > > > I'll give a try again using animate instead. > > > > Will post my result here later. > > > > On Nov 10, 6:22 pm, Michel Belleville > > wrote: > > > > > Sorry for previous mail, I misclicked on send before finishing it. > > > > > So : > > > First try the examples for > > > .slideUp()<http://docs.jquery.com/Effects/slideUp>and > > > .slideDown() <http://docs.jquery.com/Effects/slideDown>. You'll notice > > > slideUp() is a way to make an element disappear "as if" it was sliding > up, > > > and slideDown() is a way to make an element appear "as if" it was > sliding > > > down, as explained in the doc. That's not exactly what you're looking > for > > > apparently. What you are looking for is a way to move all the uls at > once up > > > or down. > > > > > Now if I wanted to do that, I'd do it this way : > > > > >- in the div#calendar, put another div.slider that'll actually be > moving > > >wrapping the uls > > >- through css give div#calendar a relative positionning so it'll be > the > > >offset parent for div.slider, give div.sider a relative positionning > too so > > >it'll also be an offset parent for the uls, make div#calendar > overflow > > >hidden so it'll act as a content window rather than get bigger to > fit around > > >the uls > > >- on click on previous / next, detect current ul, get the previous / > next > > >ul, read it's position using > > > .position()<http://docs.jquery.com/CSS/position>to determine how much > > > sliding is needed for div.slider to slide it just > > >right, then use .animate() <http://docs.jquery.com/Effects/animate> > to > > >trigger the slide > > > > > Though there may very well already be plugins that do just what you > need so > > > check wether you will be re-inventing the wheel here. > > > > > Michel Belleville > > > > > 2009/11/10 Michel Belleville > > > > > > First try the examples for .slideUp()< > http://docs.jquery.com/Effects/slideUp>and > > > > .slideDown() <http://docs.jquery.com/Effects/slideDown>. You'll > notice > > > > slideUp() is a way to make an element disappear "as if" it was > sliding up, > > > > and slideDown() is a way to make an element appear "as if" it was > sliding > > > > down, > > > > > > Michel Belleville > > > > > > 2009/11/10 Marco Barbosa > > > > > > Hi all! > > > > > >> So what I'm trying to do is so simple but it's not working.. > > > >> All I want to do is to slide up/down to the next/previous content. > > > > > >> Here's the code: > > > >> > > > >> Previous > > > >> Calendar > > > >> > > > >> Content1 > > > >> Content2 > > > >> Content3 > > > >> > > > >> > > > >> Content4 > > > >> Content5 > > > >> Content6 > > > >> > > > >> > > > >> Content7 > > > >> Content8 > > > >> Content9 > > > >> > > > >> Next > > > >> > > > > > >> Clicking arrow up down should bring up Content4, 5 and 6 and so on. > > > > > >> Here's how I'm trying to do it: > > > >> $('.arrowUp').click(function(){ > > > >>$('.events.current').removeClass("current").previous().slideDown > > > >> ("slow").addClass("current"); > > > >> }); > > > >> $('.arrowDown').click(function(){ > > > >>$('.events.current').removeClass("current").next().slideUp > > > >> ("slow").addClass("current"); > > > >> }); > > > > > >> the .events has display:none; > > > >> and .events.current has display:block; > > > > > >> What am I doing wrong? > > > >> Is there a easier way to do this? >
Re: [jQuery] Animation queue on different element?
Use the animations complete callbacks. $('#element1').fadeIn('slow', function() { $('#element2').fadeIn('slow', function() { ... }); }); Michel Belleville 2009/11/11 badtant > Hi! > > I have the two animations below running side by side: > $("#dubbelsnurra #graph1").animate({height:"154px"},1500); > $("#dubbelsnurra #graph2").animate({height:"74px"},1500); > > When they are "done" I want to start another animation on two other > elements. See below: > $("#dubbelsnurra #graph1_result,#dubbelsnurra #graph2_result").fadeIn > (500); > > What I can't figure out is how to set them on queue? I know there is > queing available in the animate function but that seems to be when you > have different animations on the same elements. > > How to I do this? > > Thanks >
Re: [jQuery] Re: Load image with an ajax preloader?
This is straight JS, I never used it before and I'm not sure how cross-browser it is but this should help : http://talideon.com/weblog/2005/02/detecting-broken-images-js.cfm Michel Belleville 2009/11/10 123gotoandplay > Hi michel, > > Tx for the explanation, i am trying your suggestion and it indeed > works like a charm. > > At the moment i am updating div imagePreview depending on a combo of > select menu options. > > As i understand it the ajax-loader.gif keeps on spinning in the > background. > Is there a way to check if the image is really loaded and if not > display another image as background saying "no image found". > > working code at the moment >$("#size_update").change(function(){ >var srcSize = $("option:selected", this).val(); >var srcColor = $("#color_update option:selected").text(); >var imgSrc = srcColor+"-"+srcSize; >$('#imagePreview').html(''); >}); >$("#color_update").change(function(){ >var srcColor = $("option:selected", this).val() ; >var srcSize = $("#size_update > option:selected").text(); >var imgSrc = srcColor+"-"+srcSize; >$('#imagePreview').html(' src="'+imgSrc+'.jpg"/>'); >}); > > .loading { > background: url(ajax-loader.gif) no-repeat center center; > } >