[jQuery] Re: [validate] phoneUS problem
A phone-method for US numbers is included in addtional-methods.js: http://jqueryjs.googlecode.com/svn/trunk/plugins/validate/additional-methods.js Jörn On Fri, Mar 27, 2009 at 2:18 AM, stegel ritp...@gmail.com wrote: When I am using the phoneUS rule in my validate options I get the following JS error: $.validator.methods[method] is undefined http://localhost/inns/inc/jquery.validate.js Line 471 As I look through jquery.validate.js, I see no reference to phoneUS. Am I missing something here? Thanks, AJ
[jQuery] Re: Ajax call with XML Response
Thanks, the text2xml function works well, however i've managed to sort what was causing the problem. My ajax .ASP page was missing response.ContentType = text/xml. Setting this enabled me to get the result as an xml document. I'm going to keep hold of text2xml as it will definately be useful. Thanks On Mar 26, 6:45 pm, James james.gp@gmail.com wrote: Does this happen in both IE and Firefox, or only in IE? If it's only in IE, IE has some kind of issue with returning XML with the incorrect header content type. Check the bottom of this post for a function:http://groups.google.com/group/jquery-en/browse_thread/thread/036d49a... Try using the function text2html by Diego A. on the returned XML data. Before you do that, remove the dataType:xml and contentType:text/ xml from your AJAX call so that IE will not error on the response due to mismatched content type. On Mar 26, 7:01 am, moocher shaunaus...@hotmail.co.uk wrote: Hi, I'm very new to JQuery and am having a problem with an Ajax call that returns xml. The error event is being fired, but the textStatus value is 'parserror' and the errorThrown value is 'undefined'. The xml response is valid so i'm not sure what could be wrong. $.ajax({ beforeSend: function() { }, type: GET, url: ajaxttest.asp, dataType: xml, timeout: 1000, contentType: text/xml, success: function(xml) { alert(in); complete: function(XMLHttpRequest, textStatus) { alert(comp); }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }); Xml: addressesaddressnumber6/number/address/addresses Any help would be great.- Hide quoted text - - Show quoted text -
[jQuery] Re: looping through json
oh, i understand now, thanks for explaining mkmanning On Mar 27, 12:01 pm, mkmanning michaell...@gmail.com wrote: Sorry, that should have read can't: which is basically my example. You CAN'T have elements in an array like this: [ department: {ID: 1, Name: Physics} ] On Mar 26, 8:59 pm, mkmanning michaell...@gmail.com wrote: This: var departments = new Array(); var department = {}; department.ID = 1; department.Name = Physics; deparments.push(department); is not a non-shorthand version of this: { departments: [ department: {ID: 1, Name: Physics}, department: {ID: 2, Name: Chemistry}, department: {ID: 3, Name: Biology} ]} it's shorthand for this: departments = [ {Value: 1, Item: Physics}, {Value: 2, Item: Chemistry}, {Value: 3, Item: Biology} ] which is basically my example. You can have elements in an array like this: [ department: {ID: 1, Name: Physics} ] unless you wrap it in {}: [ { department: {ID: 1, Name: Physics}} ] at which point the 'department' key name is not much use. @iceangel89, did you check out my example? On Mar 26, 8:47 pm, iceangel89 iceange...@gmail.com wrote: i am using PHP. intending to use Zend Framework - still PHP On Mar 27, 11:38 am, MorningZ morni...@gmail.com wrote: Talking about my first post? I'm not so sure the JSON you posted { departments: { department: {ID: 1, Name: Physics}, department: {ID: 2, Name: Chemistry}, department: {ID: 3, Name: Biology} }} is valid, as Steven points out, the last department wins even if department was department1, department2, departmentN, you still wouldn't be able to reference the items by a positional index (see the link at end of post about associative arrays) but { departments: [ department: {ID: 1, Name: Physics}, department: {ID: 2, Name: Chemistry}, department: {ID: 3, Name: Biology} ]} makes more sense perhaps if you see the non short hand version of it var departments = new Array(); var department = {}; department.ID = 1; department.Name = Physics; deparments.push(department); department = {}; //Not 100% sure if this leaves the orig obj at position 0) department.ID = 2; department.Name = Chemistry; deparments.push(department); department = {}; department.ID = 3; department.Name = Biology; deparments.push(department); would (pretty sure as i rattled that off the top of my head) be equivalent to the 2nd JSON example This should help explain a little better http://www.pageresource.com/jscript/jarray2.htm I hope that points you in the right direction What server side language are you using btw? there's a JSON converting tool for all the common languages... it takes ALL the guesswork out of this stuff On Mar 26, 10:41 pm, iceangel89 iceange...@gmail.com wrote: ok so it works. so for my understanding, the parameters department refers to the index (0, 1, 2) and dictionary refers to the json object that i can use something like dictionary.ID on On Mar 27, 10:04 am, MorningZ morni...@gmail.com wrote: Actually.. looking @ that JSON again after Steven's post, the JSON should be { departments: [ department: {ID: 1, Name: Physics}, department: {ID: 2, Name: Chemistry}, department: {ID: 3, Name: Biology} ] } Pretty sure anyways... it's been a long day :-) On Mar 26, 9:10 pm, Steven Yang kenshin...@gmail.com wrote: I think the problem is you have the department 3 times in the same hash object,so the last one overrides everything. you should change departments to an array and loop through it { departments: { department: {ID: 1, Name: Physics}, department: {ID: 2, Name: Chemistry}, department: {ID: 3, Name: Biology} }} i tried $.each(json.departments.department, function(i, n) { alert(i + + n); });
[jQuery] Re: Callback functions
When using a second object for the options, the callback must be defined in it, like this: .animate({ top : '1038px', left : '247px' }, { duration: 1400, easing:'easeInOutQuad', complete: function() { $('#anim_talkBubble') .fadeIn(1000) .animate({top : '955px'}, 1000) .fadeOut(1000); }); On Mar 26, 4:29 pm, Mike mcpat...@gmail.com wrote: Anyone know why the callback function here isn't working? $('#anim_flipper') .animate( {top : '1130px'}, {queue:false, duration: 1100} ) .animate( {left : '335px'}, {duration: 1400, easing:'easeInOutQuad'} ) .animate( {top : '1126px', left : '339px'}, { duration: 600, easing:'easeOutQuad'} ) .animate( {top : '1142px', left : '330px'}, { duration: 900, easing:'easeInOutQuad'} ) .animate( {top : '1130px', left : '335px'}, { duration: 900, easing:'easeInOutQuad'} ) .animate( {top : '1142px', left : '330px'}, { duration: 900, easing:'easeInOutQuad'} ) .animate( {top : '1130px', left : '335px'}, { duration: 900, easing:'easeInOutQuad'} ) .animate( {top : '1142px', left : '330px'}, { duration: 600, easing:'easeInOutQuad'} ) .animate( {top : '1038px', left : '247px'}, { duration: 1400, easing:'easeInOutQuad'}, function() { $('#anim_talkBubble').fadeIn(1000).animate( {top : '955px'}, 1000).fadeOut(1000); } );
[jQuery] Re: OnMouseDown = create draggable, OnMouseUp = create droppable
The solution is posted here: http://groups.google.com/group/jquery-ui/browse_thread/thread/bec7dba6705040fc/f52e524f230b93e0?lnk=gstq=delphilynx#f52e524f230b93e0 On 16 mrt, 07:35, delphilynx delphil...@gmail.com wrote: Also not the solution requested, I should post in the jQuery-UI group. Thanks for the help!
[jQuery] Re: Callback functions
for me it works like this: $('#anim_flipper').animate({top: '1130px'}, { duration: 1100}) .animate({left: '335px'}, {duration: 1400}, {easing:'easeInOutQuad'}) .animate({top: '1126px', left: '339px'}, { duration: 600}, {easing:'easeOutQuad'}) .animate({top: '1142px', left: '330px'}, { duration: 900}, {easing:'easeInOutQuad'}) .animate({top: '1130px', left: '335px'}, { duration: 900}, {easing:'easeInOutQuad'}) .animate({top: '1142px', left: '330px'}, { duration: 900}, {easing:'easeInOutQuad'}) .animate({top: '1130px', left: '335px'}, { duration: 900}, {easing:'easeInOutQuad'}) .animate({top: '1142px', left: '330px'}, { duration: 600}, {easing:'easeInOutQuad'}) .animate({top: '1038px', left: '247px'}, 1400,function() { $('#anim_talkBubble').fadeIn(1000).animate({top : '955px'}, 1000).fadeOut(1000); }); On 26 Mrz., 20:29, Mike mcpat...@gmail.com wrote: Anyone know why the callback function here isn't working? $('#anim_flipper') .animate( {top : '1130px'}, {queue:false, duration: 1100} ) .animate( {left : '335px'}, {duration: 1400, easing:'easeInOutQuad'} ) .animate( {top : '1126px', left : '339px'}, { duration: 600, easing:'easeOutQuad'} ) .animate( {top : '1142px', left : '330px'}, { duration: 900, easing:'easeInOutQuad'} ) .animate( {top : '1130px', left : '335px'}, { duration: 900, easing:'easeInOutQuad'} ) .animate( {top : '1142px', left : '330px'}, { duration: 900, easing:'easeInOutQuad'} ) .animate( {top : '1130px', left : '335px'}, { duration: 900, easing:'easeInOutQuad'} ) .animate( {top : '1142px', left : '330px'}, { duration: 600, easing:'easeInOutQuad'} ) .animate( {top : '1038px', left : '247px'}, { duration: 1400, easing:'easeInOutQuad'}, function() { $('#anim_talkBubble').fadeIn(1000).animate( {top : '955px'}, 1000).fadeOut(1000); } );
[jQuery] Re: Removing Single Option from Select
Hi, you select your select : $('#myselect'); then u find the option with the value -1 : $('#myselect').find('option[value=-1]') or $('#myselect option[value=-1]'); finally you removed it $('#myselect option[value=-1]').remove(); Pierre 2009/3/27 iceangel89 iceange...@gmail.com How can i remove a single option (with value -1, if possible) from a select?
[jQuery] Re: Executing javascript that comes inside an AJAX response
thanks mkmanning, but i do not using jquery now, i using prototype now. anyway i have moved the script to main page. will try another time. On Mar 27, 1:42 am, mkmanning michaell...@gmail.com wrote: Did you try my suggestion? -- Put this div in your main page: div id=test/div -- Put this script in your main page (essentially what you have already, fix the url for your server): $(document).ready(function(){ $.ajax({ type:GET, url:/testajax.html, dataType: html, success: function(data, status) { $('#test').html(data); } }); }); -- Put this in your ajax response (call it testajax.html or whatever you're calling): script type=text/javascript function sometesting(){ alert('this works');} //attach event with jQuery, even though there's no 'jQuery' //on this page (it will inherit from the page it's injected in) $('#tdtest').mouseover(sometesting); /script table tbody trtd onmouseover=sometesting();Inline (bad practice) works/ td/tr trtd id=tdtestAttached with jQuery (good practice) works/td/ tr /tbody /table -- So there's a function in the response ajax called sometesting(). It's called in two ways: by an inline mouseover, and by a jQuery selector (take your pick)-- both methods are on the ajax page. No higher power need be invoked. On Mar 26, 12:53 pm, Amit Shah amitsh...@gmail.com wrote: oh god. i got a function sometesting() in the ajax response text ok? not in calling main page. it's in response html data from ajax. in response there is a table. in table there is a td and on td mouseover event i call that function to highlight some fields. now the function cam from response text. ok? read properly, the response text is cam in main page div tag now. if i call the function from main page anywhere it works. but the actual even that is on mouse over of that td in response text it don't works. it says not define. now ? On Mar 27, 12:10 am, James james.gp@gmail.com wrote: What do you mean? Could you provide an example of the content of your response and what you want to do with it? You cannot call a function from inside the response html data before it reaches the browser. It has to reach the browser first because the browser does the Javascript work. If you want to do it before then, you'd have to do it server-side before sending the response. On Mar 26, 2:14 am, Amit Shah amitsh...@gmail.com wrote: you didn't get it. i mean the function written in response text. which has be evaluated. can be called only from the main script. not from inside the responsed html data. On Mar 24, 8:07 pm, mkmanning michaell...@gmail.com wrote: If you're going to use jQuery, you have to be careful about writing code that then doesn't use jQuery. In this case, you're ajax call would have worked fine, if you had stuck with injecting the response into the DOM with jQuery, as it automatically evals scripts in a response with dataType of 'html'. Change: contentDiv.innerHTML = data to (with the appropriate selector for your div): $('div').html(data); On Mar 24, 3:44 am, Amit Shah amitsh...@gmail.com wrote: it's not working. well eval(responseText); don't works. cells = divResult.getElementsByTagName(script); alert(cells.length); for (var i = 0; i cells.length; i++) { alert(cells[i].innerHTML); eval(cells[i].innerHTML); } sometesting(5); is working. but when the function sometesting() being called somewhere from ajaxresponse text, browser gives error. both ie and firefox. On Mar 15, 7:47 am, NightWatchman rushi...@gmail.com wrote: To execute javascript code returned by the server you need to use the javascript eval function on the string of script returned from the server. As far as I know changing the content of a div to a javascript block won't cause that javascript code to execute. I think you need to change: contentDiv.innerHTML = data; to eval(data); On Mar 14, 3:12 pm, Foreigner
[jQuery] jQuery and !important
Hello, I know I should actually avoid using !important, but nonetheless I'd like to set it using jQuery's css(), but it seems to ignore setting this property completely. Anyone knows if this is supposed to work or why it does not? Regards, -- Martijn.
[jQuery] Re: jQuery and !important
On Mar 27, 2009, at 1:49 PM, weidc wrote: as far as i know it doesn't work with .css(). Thanks, but after some googling (I was unable to find it before), I found: http://dev.jquery.com/ticket/2066 It shows a solution as well. Regards, -- Martijn.
[jQuery] Re: Timing of 1.3.3 release
It seems a nightly build is not something we'd want to deploy in a production environment. Any thoughts on this? What does a daily build actually represent? On Mar 26, 8:26 am, John Resig jere...@gmail.com wrote: Why not just use a nightly build? No need to wait for a full release.http://code.jquery.com/nightlies/jquery-2009-03-26.js --John On Thu, Mar 26, 2009 at 9:03 AM, dberthia dave.berthia...@gmail.com wrote: Anybody have any insight into when 1.3.3 might be released? There are a couple of bugs that are wreaking havoc on our application, but have apparently been fixed in 1.3.3 (#3993 and #4017). Thanks, - Dave
[jQuery] $this.filter('.myclass').myplugin() OR $this.is('.myclass') $this.myplugin()
I have a curiosity question, Imagine I want to apply a function (myplugin()) to a jquery object if this has a particular className. Imagine that NO jquery object has 'myclass' associated and myplugin() NOT exist. so $this.filter('.myclass').length == 0 and $this.is('.myclass') == false 1. most common possibility: throws an error (myplugin doesn't exist: It tries to bind an inexistent function to ZERO) $this.filter('.myclass').myplugin() 2. alternative possibility: no error (does nothing) $this.is('.myclass') $this.myplugin() Now imagine that myplugin() EXISTS (and you have lot of lines of this kind: different filters and methods) My question: which possibility (1 or 2) is the best in the meaning of time speed and overheads? thanxs -- Enrique Meléndez Estrada (976 01 0083) Dpto. Servicios Informáticos Área Organización y Servicios Internos INSTITUTO TECNOLÓGICO DE ARAGÓN c/ María de Luna 8, 50018, Zaragoza (Spain) emelen...@ita.es - http://www.ita.es begin:vcard fn;quoted-printable:Enrique Mel=C3=A9ndez Estrada n;quoted-printable:Mel=C3=A9ndez Estrada;Enrique org;quoted-printable;quoted-printable:Instituto Tecnol=C3=B3gico Arag=C3=B3n;Servicios Inform=C3=A1ticos adr;quoted-printable;quoted-printable:;;c/ Mar=C3=ADa de Luna, 8;Zaragoza;Zaragoza;50018;Espa=C3=B1a email;internet:emelen...@ita.es tel;work:976 01 0083 x-mozilla-html:TRUE url:http://www.ita.es version:2.1 end:vcard
[jQuery] Plugin to display large image of thumbnail on hover
As the subject says, I'm looking for a plugin that will display a larger image of the thumbnail when the mouse is hovered; something similar to iStockPhoto or Fotolia. Anyone know of such a plugin?
[jQuery] Re: cluetip retrieving parts of ajaxfile and noncaching in IE7
Hi Geert, I replied to you offlist, too, but here it is again: Passing in cache: false for jQuery's $.ajax() function, as well: $(document).ready(function() { $('a').each(function() { var thisHash = this.hash; $(this).cluetip({ ajaxCache: false, ajaxSettings: { cache: false }, ajaxProcess: function(data) { var $div = $('div/div').append(data).find(thisHash); return $div; } }); }); }); Could you try that and see if it works? thanks! --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Mar 27, 2009, at 9:21 AM, Geert Baven wrote: Hi there to you all, I try to make the tooltip retrieve an ID from an ajaxfile with this: $(document).ready(function() { $('a').each(function() { var thisHash = this.hash; $(this).cluetip({ ajaxProcess: function(data) { var $div = $('div/div').append(data).find(thisHash); return $div; } }); }); }); ajaxCache set to false does not work in IE7 how to solve this? an example of this you can find here http://strikingconcepts.nl/development/cluetip/demo/ help appreciated!
[jQuery] bind to front of event stack
Purpose: You have a number of bound events of a specific type to an element that are applied depending on specific user interactions. However, when one of them is bound, it needs to be fired first and then prevent the others from being fired until it has been unbound and then return normal behavior for the rest of the bound events. This particular bound event could be added to the stack whenever, which would could possibly allow other bound events to fire before it. Example: $('#myTestEl').click(function() { console.log('first event'); }); $('#myTestEl').click(function() { console.log('second event'); }); $('#myTestEl').click(function(e) { console.log('I would like to be first and prevent everyone else from running!'); e. stopImmediatePropagation(); }); $('#myTestEl').click(function() { console.log('forth event'); }); $('#myTestEl').click(); NORMAL OUTPUT: first event second event I would like to be first and prevent everyone else from running! DESIRED OUTPUT (if could make the third bound function the first to fire): I would like to be first and prevent everyone else from running! Then when you unbound the third function the output would be: first event second event third event I saw an older plugin that added some functionality to the bind method to do this... but the last time it was verified was against 1.2.x and hasn't been updated since. So, maybe this functionality is now part of 1.3.x and I am simply missing it in the docs?
[jQuery] Retrieving values from elements of the same class
For the following code: script src=jquery-1.3.2.js type=text/javascript/script script typetext/javascript $(document).ready(function() { $('.approve').click(function() { alert($('.approve').prev().val()); }); }); /script div input type=hidden value=1 / input type=button class=approve value=Approve / /div div input type=hidden value=2 / input type=button class=approve value=Approve / /div div input type=hidden value=3 / input type=button class=approve value=Approve / /div Each time I click on any of the button, it's returning me 1. What should I change in my javascript code to get the proper values 1, 2 or 3?
[jQuery] Re: Retrieving values from elements of the same class
alert($('.approve').prev().val()); == alert($(this).prev().val()); On Mar 27, 1:23 pm, Thierry lamthie...@gmail.com wrote: For the following code: script src=jquery-1.3.2.js type=text/javascript/script script typetext/javascript $(document).ready(function() { $('.approve').click(function() { alert($('.approve').prev().val()); }); }); /script div input type=hidden value=1 / input type=button class=approve value=Approve / /div div input type=hidden value=2 / input type=button class=approve value=Approve / /div div input type=hidden value=3 / input type=button class=approve value=Approve / /div Each time I click on any of the button, it's returning me 1. What should I change in my javascript code to get the proper values 1, 2 or 3?
[jQuery] Re: Plugin to display large image of thumbnail on hover
this isn't quite the same, but FYI: http://james.padolsey.com/demos/imgPreview/full/ there's also this: http://www.mind-projects.it/projects/jqzoom/demos.php#demo1 - Jack banacan wrote: As the subject says, I'm looking for a plugin that will display a larger image of the thumbnail when the mouse is hovered; something similar to iStockPhoto or Fotolia. Anyone know of such a plugin?
[jQuery] OT: AIR sync?
Sorry for the slightly off topic post, but I know there are some AIR devs on this list and someone might have a tip for me. I'm planning an Adobe AIR app that will be written with HTML/jQuery and needs to do offline sync (using SQLite db on AIR side, mysql on server side and json web services). IE: an online user must be able to sync their SQLite db from the server, disconnect, modify records, then reconnect and sync back to the server, with any conflicts (due to someone else changing the same record since they last got it) raised so that we can notify the user and offer a conflict resolution dialog. I've googled around a bunch, but am not finding much (about best practices, or opensource code to help me along, or 3rd party products to help). We have experience doing sync in other projects, just not in AIR, so are doing some fishing. If anyone has some links, advice, etc, thanks in advance! - Jack
[jQuery] Re: Plugin to display large image of thumbnail on hover
You could easily go to http://plugins.jquery.com/ and search thumbnail in the search box... first entry for me was Thumbnail hover popup. On Mar 27, 9:39 am, banacan banaca...@gmail.com wrote: As the subject says, I'm looking for a plugin that will display a larger image of the thumbnail when the mouse is hovered; something similar to iStockPhoto or Fotolia. Anyone know of such a plugin?
[jQuery] Re: OT: AIR sync?
It sounds like you've already made up your mind about using HTML/JS (my personal choice), but have you considered Flex in conjunction with LiveCycle Data Services? LCDS makes syncing and managing conflicts SUPER simple. andy -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Friday, March 27, 2009 1:06 PM To: jquery-en@googlegroups.com Subject: [jQuery] OT: AIR sync? Sorry for the slightly off topic post, but I know there are some AIR devs on this list and someone might have a tip for me. I'm planning an Adobe AIR app that will be written with HTML/jQuery and needs to do offline sync (using SQLite db on AIR side, mysql on server side and json web services). IE: an online user must be able to sync their SQLite db from the server, disconnect, modify records, then reconnect and sync back to the server, with any conflicts (due to someone else changing the same record since they last got it) raised so that we can notify the user and offer a conflict resolution dialog. I've googled around a bunch, but am not finding much (about best practices, or opensource code to help me along, or 3rd party products to help). We have experience doing sync in other projects, just not in AIR, so are doing some fishing. If anyone has some links, advice, etc, thanks in advance! - Jack
[jQuery] Re: Validation Success Callback
Javascript is case-sensitive: 'setTimeOut' should be 'setTimeout' On Mar 26, 5:08 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: I am using the validation plugin and the form plugin to validate my form and then submit the information via ajaxSubmit. I have everything working with the exception of my success callback function. Once the form is successfully validated I just want to wait about 2 - 3 seconds to run a script and then redirect the user to a new page. This works but the code is executed immediately: var options = { success: createAccount, clearForm: true }; $(#submitForm).validate({ rules: { //Insert Rules Here }, messages: { //Insert Messages Here }, submitHandler: function(form) { jQuery(form).ajaxSubmit(options); } }); function createAccount () { //Do Stuff setTimeOut(//Redirect, 2000); } So instead of waiting 2 seconds to redirect the code is executed as if the timer isn't even there!! Can anyone please help me with this? I have tried everything and still the timer does not work!!
[jQuery] Re: How to safely pass XML string as a param in Ajax Post?
Is the myXML part also considered data that's part of your XML? I think by setting 'processData' to false means it is. If you set it to true (default), myXML will be the name set for the variable (your XML). Try setting processData to true (or just removing that line). Also, what happens if you try: params = zone id='234'asdf/zone; And then in $.ajax: data: {myXML:params}, This separates the name and value a bit more clearly, in my opinion. On Mar 26, 1:58 pm, Karen kuts...@gmail.com wrote: Hi, I am using $.ajax POST to send some XML string to the server side code (ASP page). However, when I try to load the XML string into XMLDocument in the ASP page , I get an error saying Invalid character. :( If I changed the method to GET, it works just fine. Any ideas? Help params = myXML=zone id='234'asdf/zone; $.ajax({ url: 'getMeDataWithThisXML.asp', type: 'POST', data: params, processData: false, cache:false, async: true, success: function(result) { xmlObj = result; alert(result.xml); Thanks a lot, Karen
[jQuery] Re: bind to front of event stack
I'm not sure if there's an easy method to alter the event stack in jQuery, but I can think of a pretty straightforward workaround, providing you bind the forcestop function as the first event handler. $('#myTestEl').bind('click.forcestop', function(e){ var el = $(this), force = el.data('forcestop'); if ($.isFunction(force)){ force.apply(this, [e]); e.stopImmediatePropagation(); } }); $('#myTestEl').click( function(){ console.log('first event') } ); $('#myTestEl').click( function(){ console.log('second event') } ); $('#myTestEl').data('forcestop', function(e){ console.log('I want to be first and prevent everyone else from running!'); }); $('#myTestEl').click( function(){ console.log('fourth event') } ); $('#myTestEl').click(); Threw up a public test on: http://jsbin.com/atahi/edit Instead of actually binding a click event, you bind the would-be event handler to the element's data as forcestop, which the first click handler in the sequence will detect, trigger, then stopPropagation on. On Mar 27, 12:24 pm, sliver sliver2...@gmail.com wrote: Purpose: You have a number of bound events of a specific type to an element that are applied depending on specific user interactions. However, when one of them is bound, it needs to be fired first and then prevent the others from being fired until it has been unbound and then return normal behavior for the rest of the bound events. This particular bound event could be added to the stack whenever, which would could possibly allow other bound events to fire before it. Example: $('#myTestEl').click(function() { console.log('first event'); }); $('#myTestEl').click(function() { console.log('second event'); }); $('#myTestEl').click(function(e) { console.log('I would like to be first and prevent everyone else from running!'); e. stopImmediatePropagation();}); $('#myTestEl').click(function() { console.log('forth event'); }); $('#myTestEl').click(); NORMAL OUTPUT: first event second event I would like to be first and prevent everyone else from running! DESIRED OUTPUT (if could make the third bound function the first to fire): I would like to be first and prevent everyone else from running! Then when you unbound the third function the output would be: first event second event third event I saw an older plugin that added some functionality to the bind method to do this... but the last time it was verified was against 1.2.x and hasn't been updated since. So, maybe this functionality is now part of 1.3.x and I am simply missing it in the docs?
[jQuery] Re: Jquery validation plugin question
Thanks. It gives me an error saying element.attr is not a function What is wrong with this: highlight: function(element, errorClass) { if (element.attr(name) == aupairLanguageList) $(#multiSelect-aupairLanguageList-title).addClass(error); }, unhighlight: function(element, errorClass) { if (element.attr(name) == aupairLanguageList) $(#multiSelect-aupairLanguageList-title).removeClass (error); } On Mar 26, 12:03 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Use the highlight and unhighlight options for that. Jörn On Thu, Mar 26, 2009 at 3:21 PM, markstegg...@googlemail.com markstegg...@googlemail.com wrote: Hello, Thanks for building this validation plugin, I like it. I have a question: The error class automatically gets added to the label with the same for= name, but for a certain error I need to change the element that gains the error class. For instance, I added this line to the error placement so that a certain element receives the error class but then realised the error class would not be removed when the error is corrected by the user: code else if (element.attr(name) == aupairLanguageList) { error.insertAfter(#multiSelect-aupairLanguageList-content); $(#multiSelect-aupairLanguageList-title).addClass(error); } /code Any Ideas? Thanks
[jQuery] 1.3.2 fadeOut and floating child elements
Hi, I recently upgraded my web project from 1.2.6. (I love the speed improvements!) The HTML in the project has a lot of floating elements. And when I call the fadeOut effect on the parent div. The child elements aren't hiding like they used to. (Side Note: fadeIn does work) Example: div id=fadeMeOut div style=float:left;clear:both; div style=float:left; margin-right: 10px;Box 1 (needs to hide)/div div style=float:left;Box 2 (needs to hide)/div /div $(#fadeMeOut).fadeOut(slow); Google and docs.jquery.com, and the 1.3.2 release notes haven't given me any helpful hints as to why this is. The only thing I can think of is that the new :hidden/:visible rewrite has this function broken. Any help to get this patched would be greatly appreciated. Or a work around that doesn't include removing the floats. Thanks, Chad Shryock
[jQuery] Re: Executing javascript that comes inside an AJAX response
Hi, If its just an event(mouseover) you dont have to do this inline and shouldnt, just set up the eventlistener against the id/position in the dom. On Mar 27, 1:14 pm, Amit Shah amitsh...@gmail.com wrote: thanks mkmanning, but i do not using jquery now, i using prototype now. anyway i have moved the script to main page. will try another time. On Mar 27, 1:42 am, mkmanning michaell...@gmail.com wrote: Did you try my suggestion? -- Put this div in your main page: div id=test/div -- Put this script in your main page (essentially what you have already, fix the url for your server): $(document).ready(function(){ $.ajax({ type:GET, url:/testajax.html, dataType: html, success: function(data, status) { $('#test').html(data); } }); }); -- Put this in your ajax response (call it testajax.html or whatever you're calling): script type=text/javascript function sometesting(){ alert('this works');} //attach event with jQuery, even though there's no 'jQuery' //on this page (it will inherit from the page it's injected in) $('#tdtest').mouseover(sometesting); /script table tbody trtd onmouseover=sometesting();Inline (bad practice) works/ td/tr trtd id=tdtestAttached with jQuery (good practice) works/td/ tr /tbody /table -- So there's a function in the response ajax called sometesting(). It's called in two ways: by an inline mouseover, and by a jQuery selector (take your pick)-- both methods are on the ajax page. No higher power need be invoked. On Mar 26, 12:53 pm, Amit Shah amitsh...@gmail.com wrote: oh god. i got a function sometesting() in the ajax response text ok? not in calling main page. it's in response html data from ajax. in response there is a table. in table there is a td and on td mouseover event i call that function to highlight some fields. now the function cam from response text. ok? read properly, the response text is cam in main page div tag now. if i call the function from main page anywhere it works. but the actual even that is on mouse over of that td in response text it don't works. it says not define. now ? On Mar 27, 12:10 am, James james.gp@gmail.com wrote: What do you mean? Could you provide an example of the content of your response and what you want to do with it? You cannot call a function from inside the response html data before it reaches the browser. It has to reach the browser first because the browser does the Javascript work. If you want to do it before then, you'd have to do it server-side before sending the response. On Mar 26, 2:14 am, Amit Shah amitsh...@gmail.com wrote: you didn't get it. i mean the function written in response text. which has be evaluated. can be called only from the main script. not from inside the responsed html data. On Mar 24, 8:07 pm, mkmanning michaell...@gmail.com wrote: If you're going to use jQuery, you have to be careful about writing code that then doesn't use jQuery. In this case, you're ajax call would have worked fine, if you had stuck with injecting the response into the DOM with jQuery, as it automatically evals scripts in a response with dataType of 'html'. Change: contentDiv.innerHTML = data to (with the appropriate selector for your div): $('div').html(data); On Mar 24, 3:44 am, Amit Shah amitsh...@gmail.com wrote: it's not working. well eval(responseText); don't works. cells = divResult.getElementsByTagName(script); alert(cells.length); for (var i = 0; i cells.length; i++) { alert(cells[i].innerHTML); eval(cells[i].innerHTML); } sometesting(5); is working. but when the function sometesting() being called somewhere from ajaxresponse text, browser gives error. both ie and firefox. On Mar 15, 7:47 am, NightWatchman rushi...@gmail.com wrote: To execute javascript code returned by the server you need to use the javascript eval function on the string of script
[jQuery] Re: Trigger Problem? (tablesorter)
Try to add #: $(#table).trigger('stripe'); On Jan 31, 10:57 pm, Eric e...@ericmaicon.com.br wrote: Hello everyone!! i'm learning and doing a control panel in PHP + Ajax.. i used some plugins: script type=text/javascript src=../er.extra/jquery-latest.js/ script script type=text/javascript src=../er.extra/ jquery.tablesorter.js/script script type=text/javascript src=../er.extra/ jquery.tablesorter.pager.js/script script type=text/javascript src=../er.extra/ jquery.columnfilters.js/script it's all right, but when i add, remove or edit some row it didn't update! i used $(table).trigger('stripe'); to update but nothing happened!! can anyone help me??? xD thanks!!
[jQuery] fadeOut, fadeIn and ClearType on IE browser
Hi, I using fadeOut and fadeIn to show/hide a selected TR from a TABLE. With this code: if ( toggleSrc == toggleMinus ) {$(this).attr('src', togglePlus).parents ('tr').siblings().fadeOut('slow'); } else {$(this).attr('src', toggleMinus).parents('tr').siblings ().fadeIn('slow'); } The workaround I tried [1] is this: if (jQuery.browser.msie) { this.style.removeAttribute('filter'); } With this I can get a solve the problem, until while the animation (fading) is taking place, i can see the ugly text Any happy idea? [1] http://blog.bmn.name/2008/03/jquery-fadeinfadeout-ie-cleartype-glitch/ thanks in advanced sebastian
[jQuery] Collect all IDs in a DOM then act on specific ones
Hi all. Hopefully this question is not so dumb that it will be ignored completely. I would like to collect all IDs that start with a specific string (say #edit-field-*) and then apply the spin() plugin function to each of the matches. Thanks in advanced, Dan
[jQuery] UI Slider Tearing in Firefox
Ok, this is really bothering me. In IE7 and IE8, Opera 9 and 10a, Safari 3 and 4b, the jqueryUI slider works beautifully. However in Firefox (3.1b3), the slider handle tears while being dragged. I can't figure out what is causing it. Does firefox have a really slow refresh rate causing this tearing, or what is going wrong here. It only seems to be a problem with my code, as the slider on the example page works fine. Slider code below... $('div.scrollbar').slider({ animate: true, change: sliderChange, slide: sliderSlide }); function sliderChange(e, ui) { var maxScroll = $('div.thumbnails').attr('scrollWidth') - $('div.thumbnails').width(); $('div.thumbnails').animate({scrollLeft: ui.value * (maxScroll / 100) }, 1000); } function sliderSlide(e, ui) { var maxScroll = $('div.thumbnails').attr('scrollWidth') - $('div.thumbnails').width(); $('div.thumbnails').attr({scrollLeft: ui.value * (maxScroll / 100) }); }
[jQuery] UI Slider Tearing in Firefox
Ok, this is really bothering me. In IE7 and IE8, Opera 9 and 10a, Safari 3 and 4b, the jqueryUI slider works beautifully. However in Firefox (3.1b3), the slider handle tears while being dragged. I can't figure out what is causing it. Does firefox have a really slow refresh rate causing this tearing, or what is going wrong here. It only seems to be a problem with my code, as the slider on the example page works fine. Slider code below... $('div.scrollbar').slider({ animate: true, change: sliderChange, slide: sliderSlide }); function sliderChange(e, ui) { var maxScroll = $('div.thumbnails').attr('scrollWidth') - $('div.thumbnails').width(); $('div.thumbnails').animate({scrollLeft: ui.value * (maxScroll / 100) }, 1000); } function sliderSlide(e, ui) { var maxScroll = $('div.thumbnails').attr('scrollWidth') - $('div.thumbnails').width(); $('div.thumbnails').attr({scrollLeft: ui.value * (maxScroll / 100) }); }
[jQuery] Error with autocomplete
This is the http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ plugin Hi, I've encountered an error with the autocomplete plugin. We have 2 textboxes, both with different sources of data to populate the autocomplete. Only 1 textbox is visible at one time, both appearing in the same place. 2 links appear above the textbox which toggle visibility of the 2 textboxes. ul class=searchScope lia id=searchScopeAll href=javascript:void(0)Search All/ a/li lia id=searchScopeStaff href=javascript:void(0)Search Staff/a/li /ul div id=searchBox input id=searchTextBox type=text class=textBox value= / input id=searchStaffTextBox type=text class=textBox value= / input id=searchSubmit type=submit class=button title=Search value= / /div In document load I attach the autocomplete to both textboxes $(#searchTextBox).autocomplete(urlTagData, autocompleteTagOptions); $(#searchStaffTextBox).autocomplete(urlUserData, autocompleteStaffOptions); All this works fine. The problem arises when I click 1 of the links to toggle the checkboxes when one of the autocomplete dropdown is visible. When there is no autocomplete dropdowns visible it works fine. $(#searchScopeAll).click(function() { $(#searchTextBox).show().focus().flushCache(); $(#searchStaffTextBox).hide(); }); $(#searchScopeStaff).click(function() { $(#searchStaffTextBox).show().focus(); $(#searchTextBox).hide(); }); The error is Line 15 Error: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus. Debugging is VisualStudio found the error to be in jquery.autocomplete.js at field.focus(); If I remove field.focus(); from jquery.autocomplete.js everything seems to work fine. Can anyone shed any lght onto this one? cheers
[jQuery] Submenus above horizontal Navbar ?
Hi there, is there any possibility to change the javascript und css code, so that my submenus open above my main horizontal navigation ? I have the horizontal navigation-bar right under my header picture in wordpress and i want the dropdown menus to open above, not underneath, since this would interfere with my content. Thanks for your help... Ronald
[jQuery] Error with autocomplete
This is the http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ plugin Hi, I've encountered an error with the autocomplete plugin. We have 2 textboxes, both with different sources of data to populate the autocomplete. Only 1 textbox is visible at one time, both appearing in the same place. 2 links appear above the textbox which toggle visibility of the 2 textboxes. ul class=searchScope lia id=searchScopeAll href=javascript:void(0)Search All/ a/li lia id=searchScopeStaff href=javascript:void(0)Search Staff/a/li /ul div id=searchBox input id=searchTextBox type=text class=textBox value= / input id=searchStaffTextBox type=text class=textBox value= / input id=searchSubmit type=submit class=button title=Search value= / /div In document load I attach the autocomplete to both textboxes $(#searchTextBox).autocomplete(urlTagData, autocompleteTagOptions); $(#searchStaffTextBox).autocomplete(urlUserData, autocompleteStaffOptions); All this works fine. The problem arises when I click 1 of the links to toggle the checkboxes when one of the autocomplete dropdown is visible. When there is no autocomplete dropdowns visible it works fine. $(#searchScopeAll).click(function() { $(#searchTextBox).show().focus().flushCache(); $(#searchStaffTextBox).hide(); }); $(#searchScopeStaff).click(function() { $(#searchStaffTextBox).show().focus(); $(#searchTextBox).hide(); }); The error is Line 15 Error: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus. Debugging is VisualStudio found the error to be in jquery.autocomplete.js at field.focus(); If I remove field.focus(); from jquery.autocomplete.js everything seems to work fine. Can anyone shed any lght onto this one? cheers
[jQuery] How to keep a dialog open after browser refresh or click a action on the dialog
Hi there, When I tried to use a dialog, I had a problem. When I clicked an action button/link on a dialog, the dialog disappeared immediately. I don't know how to keep it open until I click close button. Thanks a lot.
[jQuery] slightly ot: image appended to href wraps to next line
Hi all- I'm looking to do something that I'd think has been done many times before, I'm just not finding it... After all email links on an intranet site we have, we show an envelope icon. Simple enough. pThis is a topic here If you are looking for help on this, please contact a href=mailto:bobjo...@thedomain;Bob Jonesimg src=emailicon.gif style=width:10px;height:10px; //a/p I'm doing this with rel=email and jquery, but this is more of a html question so I posted the html code as rendered... If in the paragraph Bob is on the first line and Jones is on the second, that's fine, the whole think is linked, including the icon which will be inline, right after jones on the second line. The issue occurs when Jones is at the end of the first line and there's no more room for the image. This keeps Bob Jones on the first line, but moves only the image to the second line, which looks silly. Now, I could surely use white-space:nowrap in the A style, but that would cause Bob Jones to move to the second line, when what I really want is only Jones to move to the second line. Is there some keep-with-previous-word type of css that i could set on the style of the image? Now, I am using jquery to insert the image, and maybe there's some kind of modification that I can do to only the last word, like adding a div with no wrap... Thanks in advance for you ideas. Ken
[jQuery] Submenus above horizontal Navbar ?
Hi there, is there any possibility to display my submenus above my horizontal main menu ? I have the main menu under my header (picture) and I want the submenus to displayed up there, not underneath my menu bar, where it interferes with my content section. Does anyone of you what I have to change in the javascript and css files to get this working ? Thanks for your support Ronald
[jQuery] Help using click event on looped LIs for two functions with stopPropagation and .live
Hello, I am having some difficulty using the click event between two functions. Either it bubbles like crazy or it only works for one function then stopPropagation kills it altogther for the other. Using jquery 1.3.2 for this and .live. Please if you have suggestions let me know. Working on a script where there are two unordered lists, #school_choices and #selected_schools. When the user clicks on a LI from the #school_choices an LI is appended with the same text and id to #selected_schools, the clicked LI from #school_choices is then set to display:none. The #selected_schools UL that starts out with no child nodes, once it get populated and user can click on it, the clicked #selected_schools LI gets removed and the #school_choices LI that corresponds to it (same LI id and text) is set back to display block. Regards, Seamus JS: $(function(){ function addSchool(){ var choice_id = $(this).attr('id'); var choice_value = $(this).text(); $(ul#schools_selected).append(li id='+choice_id +'+choice_value+/li); $(this).addClass(schoolHide).removeClass(schoolShow); // event.stopPropagation(); } function removeSchool(){ var selected_id = $(this).attr('id'); var selected_value = $(this).text(); $(ul#school_choices li).attr(id, selected_id).removeClass (schoolHide).addClass(schoolShow); $(this).addClass(schoolHide).removeClass(schoolShow); } $(ul#school_choices li).live(click, addSchool); $(ul#schools_selected li).live(click, removeSchool); }); CSS: .schoolShow { display: block; } .schoolHide { display:none; } HTML: ul id=schools_selected /ul ul id=school_choices li id=choice_0Choice a/li li id=choice_1Choice b/li li id=choice_2Choice c/li /ul
[jQuery] Submenus above horizontal Navbar ?
Hi there, is there any possibility to display my submenus above my horizontal main menu ? I have the main menu under my header (picture) and I want the submenus to displayed up there, not underneath my menu bar, where it interferes with my content section. Does anyone of you what I have to change in the javascript and css files to get this working ? Thanks for your support Ronald
[jQuery] Re: Call for contributors: A simple, fast and flexible grid/spreadsheet component.
Michael, I am incredibly impressed with the speed of this grid. Last month I began a search for the right grid, and I didn't find it. For my application, I needed formatting flexibility that tables could not offer, and large data-set handling that make most other grids studder. I've been using jquery for quite sometime and yet have never been compelled to post in the forums until now (as I always found my answer before I did). I truly hope an incarnation of SlickGrid makes it into jquery ui and therefore gets all the love and attention necessary to make it the star it deserves to become. -Zachariah On Mar 8, 6:31 pm, Tin michael.leib...@gmail.com wrote: Hey All, I've been working on a grid/spreadsheet control prototype during the last couple of weeks. Seeing how there doesn't seem to be a lot of other choices for this sort of thing, I had to write my own. I've put the project up on Google Code and am looking for experienced developers who can pick this up and turn it into something that everybody can use (a jQuery UI grid plugin?). The project is hosted athttp://code.google.com/p/slickgrid/. Below is a copy of the project home page. Looking forward to your feedback! Michael Leibman michael.leib...@gmail.com Principal Engineer Daptiv Inc. --- --- SlickGrid What it is Quite simply, SlickGrid is a JavaScript grid/spreadsheet component. Some highlights: Virtual scrolling/rendering (hundreds of thousands of rows) Extremely fast rendering speed Configurable customizable Full keyboard navigation Resizable/reorderable columns Custom cell formatters editors Support for editing and creating new rows. GlobalEditorLock to manage concurrent edits in cases where multiple Views on a page can edit the same data. Why? This is pretty much a work-in-progress prototype, so I don't feel like spending a lot of time documenting it at this stage. I do think it is quite promising though, so I'm putting it up for everybody to see and play with. In its current form, it satisfies nearly all of the requirements for the project I am working on where I am utilizing it in an MVC application, so I'm not sure how much time I can afford on turning SlickGrid into something that would work for everybody. If you are willing to help out - let me know, and I'll add you to the project so that you can contribute. Examples Basic use:http://slickgrid.googlecode.com/svn/trunk/example1-simple.html Adding some formatting:http://slickgrid.googlecode.com/svn/trunk/example2-formatters.html Turning it into a spreadsheet:http://slickgrid.googlecode.com/svn/trunk/example3-editing.html A more comprehensive test page:http://slickgrid.googlecode.com/svn/trunk/grid.html Documentation See comments at the top ofhttp://slickgrid.googlecode.com/svn/trunk/slick.grid.js.
[jQuery] text not right with fade
I have noticed that when i fade my text in to 100% its not just right at all it looks pixelated any suggestions. I am using the following: ???.fadeIn('slow'); method many thanks Si
[jQuery] Re: OT: AIR sync?
We've looked at LCDS, but aren't too keen on using Flex for the UI. Maybe there's some minimal way we could use it just for the sync aspect (ie as more of an internal thing)? That would be fine. - Jack Andy Matthews wrote: It sounds like you've already made up your mind about using HTML/JS (my personal choice), but have you considered Flex in conjunction with LiveCycle Data Services? LCDS makes syncing and managing conflicts SUPER simple. andy -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Friday, March 27, 2009 1:06 PM To: jquery-en@googlegroups.com Subject: [jQuery] OT: AIR sync? Sorry for the slightly off topic post, but I know there are some AIR devs on this list and someone might have a tip for me. I'm planning an Adobe AIR app that will be written with HTML/jQuery and needs to do offline sync (using SQLite db on AIR side, mysql on server side and json web services). IE: an online user must be able to sync their SQLite db from the server, disconnect, modify records, then reconnect and sync back to the server, with any conflicts (due to someone else changing the same record since they last got it) raised so that we can notify the user and offer a conflict resolution dialog. I've googled around a bunch, but am not finding much (about best practices, or opensource code to help me along, or 3rd party products to help). We have experience doing sync in other projects, just not in AIR, so are doing some fishing. If anyone has some links, advice, etc, thanks in advance! - Jack
[jQuery] Re: Jquery.Carousel -- need help understanding loading content via ajax
I've implemented the Jquery.Carousel on our site. I'm stumped on how to load content dynamically, however. Well, this is what I've hacked together. It's mess, and I'm sure incorrect in many ways. It also doesn't QUITE work how I want it to. I'd love it if anyone would be willing to jump in and proofread my logic/syntax. The goal: - Implement jCarousels with pre-loaded List Items (in this example, 6). - Upon reaching the end (or near-end) of items, go fetch some new items to append (in this case, grabbing 6 more via XML) - Ideally, show an animation 'loading' while it loads. My issues: - I don't understand the callback property. In this example, it's getting called for on each scroll. - I can load the extra items, but I can't update the carousel to scroll to them unless there's a second click on the button. - I can't get carousels own .add syntax to work. I can only replace the last LI, rather than append new ones to it (nsee remnant commented line below). Any help appreciated! Here's the script: $(#mycarousel1).jcarousel({ // Configuration goes here scroll: carouselNumberToScroll, itemLastInCallback: appendItemsToCarousel }); function appendItemsToCarousel(carousel, state){ if(carousel.last == carousel.options.size){ $.get(getMovies.xml,{},function(xml){ $('movie',xml).each(function(i) { var movieHTML; var j = carousel.options.size; movieHTML = 'img src=' + $(this).find(posterURL).text() + ' width=85 height=128 class=carouselPoster /'; movieHTML = movieHTML + $(this).find(title).text() + ' #' + j + 'br /'; movieHTML = movieHTML + $(this).find(releaseDate).text(); //carousel.add(j+1, movieHTML); var newIndex = (1*j)+1; $('li jcarouselindex=' + newIndex + ' class=regularMovies jcarousel-item jcarousel-item-horizontal jcarousel-item-'+ newIndex +' jcarousel-item-' + newIndex + '-horizontal' + movieHTML + '/li').appendTo('#mycarousel1'); carousel.options.size = newIndex; $('#mycarousel1').width($('#mycarousel1').width() + 100); alert(carousel.options.size = + carousel.options.size); }); }); }; }; The current behavior: On load 3 items in the carousel are loaded (#3 the last item shown) CLICK next button, items scroll over 2. #5 is now the last item. CLICK, items scroll over 1 (last item). #6 is now the last item. That triggers the AJAX call to load and appends the new HTML CLICK, items scroll one pixel over. #6 is now the last item. CLICK, items scroll over 2. #8 is now the last item. -DA
[jQuery] Re: OT: AIR sync?
It's possible I suppose. The problem is that the cost for LCDS (to get the data syncing) might be prohibitive for your project. You could also work with BlazeDS which has much of the same functionality of LCDS (a little brother of sorts). I've not personally done any data snycing so I'm not speaking from experience. How I might approach it though is to store a set of SQL scripts in the AIR app to get the timestamps from the local SQLite db. Stash the last synced timestamp on the file system (or in a table in the db locally). Then compare when needed with the remote database. The syncing is going to be the hard part though. Possibly you could add a column in both dbs which contained a last changed data. Then, you could also query against the last changed between the AIR app and the remote db. andy -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Friday, March 27, 2009 2:38 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: OT: AIR sync? We've looked at LCDS, but aren't too keen on using Flex for the UI. Maybe there's some minimal way we could use it just for the sync aspect (ie as more of an internal thing)? That would be fine. - Jack Andy Matthews wrote: It sounds like you've already made up your mind about using HTML/JS (my personal choice), but have you considered Flex in conjunction with LiveCycle Data Services? LCDS makes syncing and managing conflicts SUPER simple. andy -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Friday, March 27, 2009 1:06 PM To: jquery-en@googlegroups.com Subject: [jQuery] OT: AIR sync? Sorry for the slightly off topic post, but I know there are some AIR devs on this list and someone might have a tip for me. I'm planning an Adobe AIR app that will be written with HTML/jQuery and needs to do offline sync (using SQLite db on AIR side, mysql on server side and json web services). IE: an online user must be able to sync their SQLite db from the server, disconnect, modify records, then reconnect and sync back to the server, with any conflicts (due to someone else changing the same record since they last got it) raised so that we can notify the user and offer a conflict resolution dialog. I've googled around a bunch, but am not finding much (about best practices, or opensource code to help me along, or 3rd party products to help). We have experience doing sync in other projects, just not in AIR, so are doing some fishing. If anyone has some links, advice, etc, thanks in advance! - Jack
[jQuery] iframe ang jQuery
Hi Guys is it possible to embed a php website on an asp website using jQuey or is possible to create a dynamic height iframe for embedding another website running a different technology? Thank you.
[jQuery] Re: Collect all IDs in a DOM then act on specific ones
var editIDs = $([id^=edit-field-]); This will have a set of elements (regardless of type: div, span, etc.) that have id's that begin with 'edit-field-' On Mar 26, 8:35 pm, NapkinLinks d...@napkinlinks.com wrote: Hi all. Hopefully this question is not so dumb that it will be ignored completely. I would like to collect all IDs that start with a specific string (say #edit-field-*) and then apply the spin() plugin function to each of the matches. Thanks in advanced, Dan
[jQuery] Re: text not right with fade
I believe this only happens in Internet Explorer. Most of the time setting a CSS background-color to the element your text sits on will solve the issue. On Mar 27, 2:29 am, simon si...@uvfx.tv wrote: I have noticed that when i fade my text in to 100% its not just right at all it looks pixelated any suggestions. I am using the following: ???.fadeIn('slow'); method many thanks Si
[jQuery] Re: fadeOut, fadeIn and ClearType on IE browser
I believe this only happens in Internet Explorer. Most of the time setting a CSS background-color to the element your text sits on will solve the issue. On Mar 26, 10:45 pm, jgarcia sebast...@garcia-valenciano.net wrote: Hi, I using fadeOut and fadeIn to show/hide a selected TR from a TABLE. With this code: if ( toggleSrc == toggleMinus ) { $(this).attr('src', togglePlus).parents ('tr').siblings().fadeOut('slow'); } else { $(this).attr('src', toggleMinus).parents('tr').siblings ().fadeIn('slow'); } The workaround I tried [1] is this: if (jQuery.browser.msie) { this.style.removeAttribute('filter'); } With this I can get a solve the problem, until while the animation (fading) is taking place, i can see the ugly text Any happy idea? [1] http://blog.bmn.name/2008/03/jquery-fadeinfadeout-ie-cleartype-glitch/ thanks in advanced sebastian
[jQuery] Array of all checked checkboxes
I have a series of checkboxes with class=the_checkbox. I can get all checkboxes by classname and manually loop through each to find out the checked ones. I'm wondering if I can get an array of checkboxes that have been checked with one line of jQuery?
[jQuery] Re: Array of all checked checkboxes
Yes, $(.the_checkbox:checked) Documentation: http://docs.jquery.com/Selectors On Mar 27, 9:55 am, Thierry lamthie...@gmail.com wrote: I have a series of checkboxes with class=the_checkbox. I can get all checkboxes by classname and manually loop through each to find out the checked ones. I'm wondering if I can get an array of checkboxes that have been checked with one line of jQuery?
[jQuery] Re: OT: AIR sync?
Thanks, Andy. I haven't been able to find pricing for LCDS, which makes it hard to consider (without a ballpark, at least). Looks like it's an enterprise-sale kind of thing, but if you know otherwise, do tell ;-) The client-server sync, conflict resolution and offline data cache *does* sound about right for what we'd need, based on this: http://www.adobe.com/products/livecycle/dataservices/features.html There's mention in there of ajax date services, too, but nothing specifically about how it might tie into the sync stuff. Thanks for the design thoughts... that's roughly what we're thinking, too (check timestamps, do something). It's unclear to me at this point what the high-performance data sync engine in LCDS would supply. Taking a look at BlazeDS. I see that an Ajax client library can be used to talk to the BlazeDS server. Know how stable BlazeDS is? - Jack Andy Matthews wrote: It's possible I suppose. The problem is that the cost for LCDS (to get the data syncing) might be prohibitive for your project. You could also work with BlazeDS which has much of the same functionality of LCDS (a little brother of sorts). I've not personally done any data snycing so I'm not speaking from experience. How I might approach it though is to store a set of SQL scripts in the AIR app to get the timestamps from the local SQLite db. Stash the last synced timestamp on the file system (or in a table in the db locally). Then compare when needed with the remote database. The syncing is going to be the hard part though. Possibly you could add a column in both dbs which contained a last changed data. Then, you could also query against the last changed between the AIR app and the remote db. andy -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Friday, March 27, 2009 2:38 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: OT: AIR sync? We've looked at LCDS, but aren't too keen on using Flex for the UI. Maybe there's some minimal way we could use it just for the sync aspect (ie as more of an internal thing)? That would be fine. - Jack Andy Matthews wrote: It sounds like you've already made up your mind about using HTML/JS (my personal choice), but have you considered Flex in conjunction with LiveCycle Data Services? LCDS makes syncing and managing conflicts SUPER simple. andy -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Friday, March 27, 2009 1:06 PM To: jquery-en@googlegroups.com Subject: [jQuery] OT: AIR sync? Sorry for the slightly off topic post, but I know there are some AIR devs on this list and someone might have a tip for me. I'm planning an Adobe AIR app that will be written with HTML/jQuery and needs to do offline sync (using SQLite db on AIR side, mysql on server side and json web services). IE: an online user must be able to sync their SQLite db from the server, disconnect, modify records, then reconnect and sync back to the server, with any conflicts (due to someone else changing the same record since they last got it) raised so that we can notify the user and offer a conflict resolution dialog. I've googled around a bunch, but am not finding much (about best practices, or opensource code to help me along, or 3rd party products to help). We have experience doing sync in other projects, just not in AIR, so are doing some fishing. If anyone has some links, advice, etc, thanks in advance! - Jack
[jQuery] Re: Help using click event on looped LIs for two functions with stopPropagation and .live
I didn't look into it that deeply, but one issue I see is that when you click on the school choices, you're using the same ID from that LI to create a new LI in the schools selected with the same LI. You can only have one unique ID per HTML document. One suggestion is to just parse the LI's ID for the number and create a new ID for the schools selected. var choice_id = $(this).attr(id).split('_')[1]; // from 'choice_0' gives you '0' On Mar 27, 4:58 am, seamusjr seamu...@hotmail.com wrote: Hello, I am having some difficulty using the click event between two functions. Either it bubbles like crazy or it only works for one function then stopPropagation kills it altogther for the other. Using jquery 1.3.2 for this and .live. Please if you have suggestions let me know. Working on a script where there are two unordered lists, #school_choices and #selected_schools. When the user clicks on a LI from the #school_choices an LI is appended with the same text and id to #selected_schools, the clicked LI from #school_choices is then set to display:none. The #selected_schools UL that starts out with no child nodes, once it get populated and user can click on it, the clicked #selected_schools LI gets removed and the #school_choices LI that corresponds to it (same LI id and text) is set back to display block. Regards, Seamus JS: $(function(){ function addSchool(){ var choice_id = $(this).attr('id'); var choice_value = $(this).text(); $(ul#schools_selected).append(li id='+choice_id +'+choice_value+/li); $(this).addClass(schoolHide).removeClass(schoolShow); // event.stopPropagation(); } function removeSchool(){ var selected_id = $(this).attr('id'); var selected_value = $(this).text(); $(ul#school_choices li).attr(id, selected_id).removeClass (schoolHide).addClass(schoolShow); $(this).addClass(schoolHide).removeClass(schoolShow); } $(ul#school_choices li).live(click, addSchool); $(ul#schools_selected li).live(click, removeSchool); }); CSS: .schoolShow { display: block; } .schoolHide { display:none; } HTML: ul id=schools_selected /ul ul id=school_choices li id=choice_0Choice a/li li id=choice_1Choice b/li li id=choice_2Choice c/li /ul
[jQuery] Re: iframe ang jQuery
It doesn't matter what is used to generate the (x)html/css. Just set the src of the iframe to the URL and it should work. On Mar 27, 3:47 pm, themba themba.ntl...@gmail.com wrote: Hi Guys is it possible to embed a php website on an asp website using jQuey or is possible to create a dynamic height iframe for embedding another website running a different technology? Thank you.
[jQuery] Re: Array of all checked checkboxes
Simple example: body script src=jquery.js/script input class=cbx id=cbx1 type=checkbox / input class=cbx id=cbx2 type=checkbox checked=true / input class=cbx id=cbx3 type=checkbox checked=true / input class=cbx id=cbx4 type=checkbox / input class=cbx id=cbx5 type=checkbox / script var checked = $('.cbx:checked'); alert(checked[0].id+, +checked[1].id) /script /body On Mar 27, 3:55 pm, Thierry lamthie...@gmail.com wrote: I have a series of checkboxes with class=the_checkbox. I can get all checkboxes by classname and manually loop through each to find out the checked ones. I'm wondering if I can get an array of checkboxes that have been checked with one line of jQuery?
[jQuery] Collect all IDs in a DOM then act on specific ones
Hi all. Forgive my simplistic question, but how would one go about applying a jQuery plugin function to IDs that start with a specific string (say edit-field-*). For example, instead of applying spin() to the field specified below, how do I traverse the DOM and apply it to all IDs that start with edit-field-*)? $(document).ready(function(){ $(#edit-field-player-strength-0-value).spin({imageBasePath:/ files/,max:100,min:2,interval:2}); }); Thanks in advance. Dan
[jQuery] Re: Collect all IDs in a DOM then act on specific ones
Thanks James! On Mar 27, 12:49 pm, James james.gp@gmail.com wrote: var editIDs = $([id^=edit-field-]); This will have a set of elements (regardless of type: div, span, etc.) that have id's that begin with 'edit-field-' On Mar 26, 8:35 pm, NapkinLinks d...@napkinlinks.com wrote: Hi all. Hopefully this question is not so dumb that it will be ignored completely. I would like to collect all IDs that start with a specific string (say #edit-field-*) and then apply the spin() plugin function to each of the matches. Thanks in advanced, Dan
[jQuery] How to load redirected content in dialog?
I have some content that loads in a dialog popup via ajax. For some reason when the URL redirects (i.e. 301, 302, etc.), the content never loads in the dialog. Is this normal behavior for ajax, or should the redirected content load? Thanks. a href=url_that_redirects class=myDialogdo something/a $(.myDialog).click(function() { $(this).openDialog(); }); $.fn.openDialog = function () { var url = $(this).attr(href); popup = $(this).dialog(); $.ajax( { url: url, success: function(message) { popup.html(message); }, error: function() { popup.html(div class='portlet-msg-error'The content could not be loaded./div); }, timeout: 2 } ); return this; };
[jQuery] Re: iframe ang jQuery
Thank you, my problem is that a normal iframe cannot have an auto height, I don't want any scroll bars shown, the iframe should be resized according to contents. I was hoping maybe there is a solution to this using jQuery. Thank you. On Mar 27, 10:05 pm, jay jay.ab...@gmail.com wrote: It doesn't matter what is used to generate the (x)html/css. Just set the src of the iframe to the URL and it should work. On Mar 27, 3:47 pm, themba themba.ntl...@gmail.com wrote: Hi Guys is it possible to embed a php website on an asp website using jQuey or is possible to create a dynamic height iframe for embedding another website running a different technology? Thank you.
[jQuery] Re: Collect all IDs in a DOM then act on specific ones
You would probably have better luck assigning non-styling classes to the elements to search on instead of doing the regex check. So instead of finding all tags with id=edit-field-*, find all tags with the edit-field class On Mar 27, 4:30 pm, NapkinLinks d...@napkinlinks.com wrote: Thanks James! On Mar 27, 12:49 pm, James james.gp@gmail.com wrote: var editIDs = $([id^=edit-field-]); This will have a set of elements (regardless of type: div, span, etc.) that have id's that begin with 'edit-field-' On Mar 26, 8:35 pm, NapkinLinks d...@napkinlinks.com wrote: Hi all. Hopefully this question is not so dumb that it will be ignored completely. I would like to collect all IDs that start with a specific string (say #edit-field-*) and then apply the spin() plugin function to each of the matches. Thanks in advanced, Dan
[jQuery] Re: OT: AIR sync?
I don't know the current version, but my company was willing to put the initial release into production for using in a broadcasting application AIR app that I wrote in jQuery/HTML, sort of a one way instant messenger. It seemed very stable at the time, and that was almost a year ago. It's a pretty cool thing, but don't let their marketing chatter about push kid you. It's polling plain and simple. That's okay, but not really what they advertise it as. One thing I'll warn you of. If you end up using BlazeDS I discovered a bug where transparent HTML AIR apps would not function if you used BlazeDS. Turn transparency off and it worked just fine. andy _ From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Friday, March 27, 2009 3:13 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: OT: AIR sync? Thanks, Andy. I haven't been able to find pricing for LCDS, which makes it hard to consider (without a ballpark, at least). Looks like it's an enterprise-sale kind of thing, but if you know otherwise, do tell ;-) The client-server sync, conflict resolution and offline data cache *does* sound about right for what we'd need, based on this: http://www.adobe.com/products/livecycle/dataservices/features.html There's mention in there of ajax date services, too, but nothing specifically about how it might tie into the sync stuff. Thanks for the design thoughts... that's roughly what we're thinking, too (check timestamps, do something). It's unclear to me at this point what the high-performance data sync engine in LCDS would supply. Taking a look at BlazeDS. I see that an Ajax client library can be used to talk to the BlazeDS server. Know how stable BlazeDS is? - Jack Andy Matthews wrote: It's possible I suppose. The problem is that the cost for LCDS (to get the data syncing) might be prohibitive for your project. You could also work with BlazeDS which has much of the same functionality of LCDS (a little brother of sorts). I've not personally done any data snycing so I'm not speaking from experience. How I might approach it though is to store a set of SQL scripts in the AIR app to get the timestamps from the local SQLite db. Stash the last synced timestamp on the file system (or in a table in the db locally). Then compare when needed with the remote database. The syncing is going to be the hard part though. Possibly you could add a column in both dbs which contained a last changed data. Then, you could also query against the last changed between the AIR app and the remote db. andy -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Friday, March 27, 2009 2:38 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: OT: AIR sync? We've looked at LCDS, but aren't too keen on using Flex for the UI. Maybe there's some minimal way we could use it just for the sync aspect (ie as more of an internal thing)? That would be fine. - Jack Andy Matthews wrote: It sounds like you've already made up your mind about using HTML/JS (my personal choice), but have you considered Flex in conjunction with LiveCycle Data Services? LCDS makes syncing and managing conflicts SUPER simple. andy -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Friday, March 27, 2009 1:06 PM To: jquery-en@googlegroups.com Subject: [jQuery] OT: AIR sync? Sorry for the slightly off topic post, but I know there are some AIR devs on this list and someone might have a tip for me. I'm planning an Adobe AIR app that will be written with HTML/jQuery and needs to do offline sync (using SQLite db on AIR side, mysql on server side and json web services). IE: an online user must be able to sync their SQLite db from the server, disconnect, modify records, then reconnect and sync back to the server, with any conflicts (due to someone else changing the same record since they last got it) raised so that we can notify the user and offer a conflict resolution dialog. I've googled around a bunch, but am not finding much (about best practices, or opensource code to help me along, or 3rd party products to help). We have experience doing sync in other projects, just not in AIR, so are doing some fishing. If anyone has some links, advice, etc, thanks in advance! - Jack
[jQuery] Re: Array of all checked checkboxes
How about: var checkedBoxes = $('input.the_checkbox:checked'); FYI -- http://docs.jquery.com/Selectors/checked On Mar 27, 3:55 pm, Thierry lamthie...@gmail.com wrote: I have a series of checkboxes with class=the_checkbox. I can get all checkboxes by classname and manually loop through each to find out the checked ones. I'm wondering if I can get an array of checkboxes that have been checked with one line of jQuery?
[jQuery] [validate] email validation problem
I am trying to validate emails in the format n...@chs.k12.oh.us. This format fails using the email method of the validate plugin. It appears to fail on the length because n...@chs.k.oh.us works but n...@chs.ka.oh.us does not (basically anything longer than one character fails). I'm using this on a site for schools so there will be lots of emails in this format. I am terrible with RegEx so any help would be greatly appreciated.
[jQuery] How to remove elements from the page efficiently.
Hi Guys ! Situation is the following, I display a list of entries ~60 inside div. Each entry is a div too. When I try to clear this list using either jQuery(#list).empty() or $('#list').html('') it's terrible slow especially on firefox. Any suggestion how the list should be emptied? Best regards and thanks in advance Pawel
[jQuery] Re: bind to front of event stack
It's potentially a pain, but if you know all of the events bound to it, you could unbind, add your event, then add all of the others. I too wish there was an easy way to view/modify the event stack... Best of luck.
[jQuery] JQuery and PS3?
Hi I was just wondering whether Jquery works on the PS3 natively (even if limited) and if not, how to do so? thanks
[jQuery] JQuery and PS3?
Is there anyway to make the following functions of jquery work on the PS3's web browser or does it work at all with the latest firmware installed? Thanks..
[jQuery] Re: How to remove elements from the page efficiently.
Try giving this a read: http://blog.stevenlevithan.com/archives/faster-than-innerhtml when I've tried it on table rows it worked extremely fast for me. On Mar 27, 11:08 am, deltron pawel.le...@gmail.com wrote: Hi Guys ! Situation is the following, I display a list of entries ~60 inside div. Each entry is a div too. When I try to clear this list using either jQuery(#list).empty() or $('#list').html('') it's terrible slow especially on firefox. Any suggestion how the list should be emptied? Best regards and thanks in advance Pawel
[jQuery] Re: JQuery and PS3?
Looks like no: http://groups.google.com/group/jquery-en/browse_thread/thread/739175c128a6f633 - Richard On Fri, Mar 27, 2009 at 4:33 PM, superaktieboy superaktie...@gmail.comwrote: Hi I was just wondering whether Jquery works on the PS3 natively (even if limited) and if not, how to do so? thanks
[jQuery] Re: OT: AIR sync?
Thanks for the info. I took a look a BlazeDS and it looks like it's just a messaging system for Flex-to-Java/services messaging (or js-to-flex-to-java via js bridge), not anything specific for db manipulation or sync. Did I read it right? - Jack Andy Matthews wrote: I don't know the current version, but my company was willing to put the initial release into production for using in a broadcasting application AIR app that I wrote in jQuery/HTML, sort of a one way instant messenger. It seemed very stable at the time, and that was almost a year ago. It's a pretty cool thing, but don't let their marketing chatter about push kid you. It's polling plain and simple. That's okay, but not really what they advertise it as. One thing I'll warn you of. If you end up using BlazeDS I discovered a bug where transparent HTML AIR apps would not function if you used BlazeDS. Turn transparency off and it worked just fine. andy *From:* jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] *On Behalf Of *Jack Killpatrick *Sent:* Friday, March 27, 2009 3:13 PM *To:* jquery-en@googlegroups.com *Subject:* [jQuery] Re: OT: AIR sync? Thanks, Andy. I haven't been able to find pricing for LCDS, which makes it hard to consider (without a ballpark, at least). Looks like it's an enterprise-sale kind of thing, but if you know otherwise, do tell ;-) The client-server sync, conflict resolution and offline data cache *does* sound about right for what we'd need, based on this: http://www.adobe.com/products/livecycle/dataservices/features.html There's mention in there of ajax date services, too, but nothing specifically about how it might tie into the sync stuff. Thanks for the design thoughts... that's roughly what we're thinking, too (check timestamps, do something). It's unclear to me at this point what the high-performance data sync engine in LCDS would supply. Taking a look at BlazeDS. I see that an Ajax client library can be used to talk to the BlazeDS server. Know how stable BlazeDS is? - Jack Andy Matthews wrote: It's possible I suppose. The problem is that the cost for LCDS (to get the data syncing) might be prohibitive for your project. You could also work with BlazeDS which has much of the same functionality of LCDS (a little brother of sorts). I've not personally done any data snycing so I'm not speaking from experience. How I might approach it though is to store a set of SQL scripts in the AIR app to get the timestamps from the local SQLite db. Stash the last synced timestamp on the file system (or in a table in the db locally). Then compare when needed with the remote database. The syncing is going to be the hard part though. Possibly you could add a column in both dbs which contained a last changed data. Then, you could also query against the last changed between the AIR app and the remote db. andy -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Friday, March 27, 2009 2:38 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: OT: AIR sync? We've looked at LCDS, but aren't too keen on using Flex for the UI. Maybe there's some minimal way we could use it just for the sync aspect (ie as more of an internal thing)? That would be fine. - Jack Andy Matthews wrote: It sounds like you've already made up your mind about using HTML/JS (my personal choice), but have you considered Flex in conjunction with LiveCycle Data Services? LCDS makes syncing and managing conflicts SUPER simple. andy -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Friday, March 27, 2009 1:06 PM To: jquery-en@googlegroups.com Subject: [jQuery] OT: AIR sync? Sorry for the slightly off topic post, but I know there are some AIR devs on this list and someone might have a tip for me. I'm planning an Adobe AIR app that will be written with HTML/jQuery and needs to do offline sync (using SQLite db on AIR side, mysql on server side and json web services). IE: an online user must be able to sync their SQLite db from the server, disconnect, modify records, then reconnect and sync back to the server, with any conflicts (due to someone else changing the same record since they last got it) raised so that we can notify the user and offer a conflict resolution dialog. I've googled around a bunch, but am not finding much (about best practices, or opensource code to help me along, or 3rd party products to help). We have experience doing sync in other projects, just not in AIR, so are doing some fishing. If anyone has some links, advice, etc, thanks in advance! - Jack
[jQuery] Using .live between 2 ULs without bubbling or premature stopProp
I am having some difficulty using the click event between two functions. Either it bubbles like crazy or it only works for one function then stopPropagation kills it altogther for the other. Using jquery 1.3.2 for this and .live. Please if you have suggestions let me know. Working on a script where there are two unordered lists, #school_choices and #selected_schools. When the user clicks on a LI from the #school_choices an LI is appended with the same text and id to #selected_schools, the clicked LI from #school_choices is then set to display:none. The #selected_schools UL that starts out with no child nodes, once it get populated and user can click on it, the clicked #selected_schools LI gets removed and the #school_choices LI that corresponds to it (same LI id and text) is set back to display block. Regards, Seamus JS: $(function(){ function addSchool(){ var choice_id = $(this).attr('id'); var choice_value = $(this).text(); $(ul#schools_selected).append(li id='+choice_id +'+choice_value+/li); $(this).addClass(schoolHide).removeClass(schoolShow); // event.stopPropagation(); } function removeSchool(){ var selected_id = $(this).attr('id'); var selected_value = $(this).text(); $(ul#school_choices li).attr(id, selected_id).removeClass (schoolHide).addClass(schoolShow); $(this).addClass(schoolHide).removeClass(schoolShow); } $(ul#school_choices li).live(click, addSchool); $(ul#schools_selected li).live(click, removeSchool); }); CSS: .schoolShow { display: block; } .schoolHide { display:none; } HTML: ul id=schools_selected /ul ul id=school_choices li id=choice_0Choice a/li li id=choice_1Choice b/li li id=choice_2Choice c/li /ul
[jQuery] Can I use JQuery to receive multipart data?
I need to receive a multipart message from server, how can I use jquery to do that? Thanks! Cindy
[jQuery] Re: OT: AIR sync?
Mostly. Using Blaze allows you to communicate via remoting, which is a binary protocol. It's faster and lighterweight. However, the data sync is where LCDS really gets it's muscle. andy _ From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Friday, March 27, 2009 4:24 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: OT: AIR sync? Thanks for the info. I took a look a BlazeDS and it looks like it's just a messaging system for Flex-to-Java/services messaging (or js-to-flex-to-java via js bridge), not anything specific for db manipulation or sync. Did I read it right? - Jack Andy Matthews wrote: I don't know the current version, but my company was willing to put the initial release into production for using in a broadcasting application AIR app that I wrote in jQuery/HTML, sort of a one way instant messenger. It seemed very stable at the time, and that was almost a year ago. It's a pretty cool thing, but don't let their marketing chatter about push kid you. It's polling plain and simple. That's okay, but not really what they advertise it as. One thing I'll warn you of. If you end up using BlazeDS I discovered a bug where transparent HTML AIR apps would not function if you used BlazeDS. Turn transparency off and it worked just fine. andy _ From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Friday, March 27, 2009 3:13 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: OT: AIR sync? Thanks, Andy. I haven't been able to find pricing for LCDS, which makes it hard to consider (without a ballpark, at least). Looks like it's an enterprise-sale kind of thing, but if you know otherwise, do tell ;-) The client-server sync, conflict resolution and offline data cache *does* sound about right for what we'd need, based on this: http://www.adobe.com/products/livecycle/dataservices/features.html There's mention in there of ajax date services, too, but nothing specifically about how it might tie into the sync stuff. Thanks for the design thoughts... that's roughly what we're thinking, too (check timestamps, do something). It's unclear to me at this point what the high-performance data sync engine in LCDS would supply. Taking a look at BlazeDS. I see that an Ajax client library can be used to talk to the BlazeDS server. Know how stable BlazeDS is? - Jack Andy Matthews wrote: It's possible I suppose. The problem is that the cost for LCDS (to get the data syncing) might be prohibitive for your project. You could also work with BlazeDS which has much of the same functionality of LCDS (a little brother of sorts). I've not personally done any data snycing so I'm not speaking from experience. How I might approach it though is to store a set of SQL scripts in the AIR app to get the timestamps from the local SQLite db. Stash the last synced timestamp on the file system (or in a table in the db locally). Then compare when needed with the remote database. The syncing is going to be the hard part though. Possibly you could add a column in both dbs which contained a last changed data. Then, you could also query against the last changed between the AIR app and the remote db. andy -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Friday, March 27, 2009 2:38 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: OT: AIR sync? We've looked at LCDS, but aren't too keen on using Flex for the UI. Maybe there's some minimal way we could use it just for the sync aspect (ie as more of an internal thing)? That would be fine. - Jack Andy Matthews wrote: It sounds like you've already made up your mind about using HTML/JS (my personal choice), but have you considered Flex in conjunction with LiveCycle Data Services? LCDS makes syncing and managing conflicts SUPER simple. andy -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Friday, March 27, 2009 1:06 PM To: jquery-en@googlegroups.com Subject: [jQuery] OT: AIR sync? Sorry for the slightly off topic post, but I know there are some AIR devs on this list and someone might have a tip for me. I'm planning an Adobe AIR app that will be written with HTML/jQuery and needs to do offline sync (using SQLite db on AIR side, mysql on server side and json web services). IE: an online user must be able to sync their SQLite db from the server, disconnect, modify records, then reconnect and sync back to the server, with any conflicts (due to someone else changing the same record since they last got it) raised so that we can notify the user and offer a conflict resolution dialog. I've googled around a bunch, but am not finding much (about best practices, or opensource code to help me along, or
[jQuery] Re: Using .live between 2 ULs without bubbling or premature stopProp
I've responded to your first posting already: http://groups.google.com/group/jquery-en/browse_thread/thread/93d1491c0890fe55# On Mar 27, 11:27 am, seamusjr seamu...@hotmail.com wrote: I am having some difficulty using the click event between two functions. Either it bubbles like crazy or it only works for one function then stopPropagation kills it altogther for the other. Using jquery 1.3.2 for this and .live. Please if you have suggestions let me know. Working on a script where there are two unordered lists, #school_choices and #selected_schools. When the user clicks on a LI from the #school_choices an LI is appended with the same text and id to #selected_schools, the clicked LI from #school_choices is then set to display:none. The #selected_schools UL that starts out with no child nodes, once it get populated and user can click on it, the clicked #selected_schools LI gets removed and the #school_choices LI that corresponds to it (same LI id and text) is set back to display block. Regards, Seamus JS: $(function(){ function addSchool(){ var choice_id = $(this).attr('id'); var choice_value = $(this).text(); $(ul#schools_selected).append(li id='+choice_id +'+choice_value+/li); $(this).addClass(schoolHide).removeClass(schoolShow); // event.stopPropagation(); } function removeSchool(){ var selected_id = $(this).attr('id'); var selected_value = $(this).text(); $(ul#school_choices li).attr(id, selected_id).removeClass (schoolHide).addClass(schoolShow); $(this).addClass(schoolHide).removeClass(schoolShow); } $(ul#school_choices li).live(click, addSchool); $(ul#schools_selected li).live(click, removeSchool); }); CSS: .schoolShow { display: block; } .schoolHide { display:none; } HTML: ul id=schools_selected /ul ul id=school_choices li id=choice_0Choice a/li li id=choice_1Choice b/li li id=choice_2Choice c/li /ul
[jQuery] Selecting dynamic elements
Is it possible to select an element from dynamically created elements before the tree is attached to the document? Given: $elems = $('div id=outerdiv id=innerhello/div/div'); Is there any way to select and operate on the inner div before attaching these element to anything?
[jQuery] Re: Selecting dynamic elements
Try it out: $inner = $elems.find(#inner); alert( $inner.text() ); On Mar 27, 11:55 am, schickb schi...@gmail.com wrote: Is it possible to select an element from dynamically created elements before the tree is attached to the document? Given: $elems = $('div id=outerdiv id=innerhello/div/div'); Is there any way to select and operate on the inner div before attaching these element to anything?
[jQuery] Re: How to remove elements from the page efficiently.
thanks, I will give a try and get back with the results. /Pawel On 27 Mar, 22:21, James james.gp@gmail.com wrote: Try giving this a read:http://blog.stevenlevithan.com/archives/faster-than-innerhtml when I've tried it on table rows it worked extremely fast for me. On Mar 27, 11:08 am, deltron pawel.le...@gmail.com wrote: Hi Guys ! Situation is the following, I display a list of entries ~60 inside div. Each entry is a div too. When I try to clear this list using either jQuery(#list).empty() or $('#list').html('') it's terrible slow especially on firefox. Any suggestion how the list should be emptied? Best regards and thanks in advance Pawel
[jQuery] Re: [validate] email validation problem
That's an odd problem. I'm looking into it! Jörn On Fri, Mar 27, 2009 at 9:03 PM, emeade em.me...@gmail.com wrote: I am trying to validate emails in the format n...@chs.k12.oh.us. This format fails using the email method of the validate plugin. It appears to fail on the length because n...@chs.k.oh.us works but n...@chs.ka.oh.us does not (basically anything longer than one character fails). I'm using this on a site for schools so there will be lots of emails in this format. I am terrible with RegEx so any help would be greatly appreciated.
[jQuery] Re: Call for contributors: A simple, fast and flexible grid/spreadsheet component.
Zachariah, Thanks for the word of encouragement! Do you have any feedback/ lessons learned from your application? I've made a lot of progress recently in terms of adding a DataView to drive the grid and optimizing the core loop, but formalizing the API and writing the documentation haven't been moving very fast. Unfortunately, without that documentation, a lot of people seem to be dismissing it at first glance without realizing what makes SlickGrid different. +Michael On Mar 27, 4:24 am, Zachariah craniumcomput...@gmail.com wrote: Michael, I am incredibly impressed with the speed of this grid. Last month I began a search for the right grid, and I didn't find it. For my application, I needed formatting flexibility that tables could not offer, and large data-set handling that make most other grids studder. I've been using jquery for quite sometime and yet have never been compelled to post in the forums until now (as I always found my answer before I did). I truly hope an incarnation of SlickGrid makes it into jquery ui and therefore gets all the love and attention necessary to make it the star it deserves to become. -Zachariah On Mar 8, 6:31 pm, Tin michael.leib...@gmail.com wrote: Hey All, I've been working on a grid/spreadsheet control prototype during the last couple of weeks. Seeing how there doesn't seem to be a lot of other choices for this sort of thing, I had to write my own. I've put the project up on Google Code and am looking for experienced developers who can pick this up and turn it into something that everybody can use (a jQuery UI grid plugin?). The project is hosted athttp://code.google.com/p/slickgrid/. Below is a copy of the project home page. Looking forward to your feedback! Michael Leibman michael.leib...@gmail.com Principal Engineer Daptiv Inc. --- --- SlickGrid What it is Quite simply, SlickGrid is a JavaScript grid/spreadsheet component. Some highlights: Virtual scrolling/rendering (hundreds of thousands of rows) Extremely fast rendering speed Configurable customizable Full keyboard navigation Resizable/reorderable columns Custom cell formatters editors Support for editing and creating new rows. GlobalEditorLock to manage concurrent edits in cases where multiple Views on a page can edit the same data. Why? This is pretty much a work-in-progress prototype, so I don't feel like spending a lot of time documenting it at this stage. I do think it is quite promising though, so I'm putting it up for everybody to see and play with. In its current form, it satisfies nearly all of the requirements for the project I am working on where I am utilizing it in an MVC application, so I'm not sure how much time I can afford on turning SlickGrid into something that would work for everybody. If you are willing to help out - let me know, and I'll add you to the project so that you can contribute. Examples Basic use:http://slickgrid.googlecode.com/svn/trunk/example1-simple.html Adding some formatting:http://slickgrid.googlecode.com/svn/trunk/example2-formatters.html Turning it into a spreadsheet:http://slickgrid.googlecode.com/svn/trunk/example3-editing.html A more comprehensive test page:http://slickgrid.googlecode.com/svn/trunk/grid.html Documentation See comments at the top ofhttp://slickgrid.googlecode.com/svn/trunk/slick.grid.js.
[jQuery] Re: How to remove elements from the page efficiently.
first tests make me impressed, it's extremely fast definitely works for me. thanks again for your support /pl On 27 Mar, 23:05, deltron pawel.le...@gmail.com wrote: thanks, I will give a try and get back with the results. /Pawel On 27 Mar, 22:21, James james.gp@gmail.com wrote: Try giving this a read:http://blog.stevenlevithan.com/archives/faster-than-innerhtml when I've tried it on table rows it worked extremely fast for me. On Mar 27, 11:08 am, deltron pawel.le...@gmail.com wrote: Hi Guys ! Situation is the following, I display a list of entries ~60 inside div. Each entry is a div too. When I try to clear this list using either jQuery(#list).empty() or $('#list').html('') it's terrible slow especially on firefox. Any suggestion how the list should be emptied? Best regards and thanks in advance Pawel
[jQuery] Re: Can I use JQuery to receive multipart data?
More information, I need to use multipart to keep connect alive to server push. I use the save technology using java, but I don't know how to use JQuery to do that. Your help is great appreciated. On Mar 27, 1:29 pm, cindy ypu01...@yahoo.com wrote: I need to receive a multipart message from server, how can I use jquery to do that? Thanks! Cindy
[jQuery] jQuery + PHP Form Validation
So I am working on an AJAX call to a PHP script which validates the data submitted in a form. My question concerns the best way to get the data from PHP back to the jQuery script. Should the dataType field be html or script? I tried html and I know I could parse out what I need, but in the documentation it says script runs the code as a javascript script, but I'm not sure of the scope of this script. I tried setting a variable name in the script and changing a global variable value, but I saw no change when I displayed the value with alert(). Am I missing something? Code below: $.ajax({ type: POST, url: /register/index.php?action=validate, data: email=+ email + pass1= + pass1, dataType: script,//html, complete: function (XMLHttpRequest, textStatus) { alert(complete); }, success: function(del){ alert(success); alert(del); alert(email); $(#email).addClass(error); /*$('form#submit').hide(); $('div.success').fadeIn();*/ }, error: function (xhr, desc, exceptionobj) { alert(error); //alert(xhr.responseText); alert(exceptionobj); } }); I can make the PHP file return whatever I want. What is the best in this situation? Thanks!
[jQuery] jQuery + PHP Form Validation
So I am working on an AJAX call to a PHP script which validates the data submitted in a form. My question concerns the best way to get the data from PHP back to the jQuery script. Should the dataType field be html or script? I tried html and I know I could parse out what I need, but in the documentation it says script runs the code as a javascript script, but I'm not sure of the scope of this script. I tried setting a variable name in the script and changing a global variable value, but I saw no change when I displayed the value with alert(). Am I missing something? Code below: $.ajax({ type: POST, url: /register/index.php?action=validate, data: email=+ email + pass1= + pass1, dataType: script,//html, complete: function (XMLHttpRequest, textStatus) { alert(complete); }, success: function(del){ alert(success); alert(del); alert(email); $(#email).addClass(error); /*$('form#submit').hide(); $('div.success').fadeIn();*/ }, error: function (xhr, desc, exceptionobj) { alert(error); //alert(xhr.responseText); alert(exceptionobj); } }); I can make the PHP file return whatever I want. What is the best in this situation? Thanks!
[jQuery] Re: bind to front of event stack
I've come up with a little plugin that will allow you to bind any event (including custom ones) into a specified position in the event stack. http://snipplr.com/view/13515/jstack--jquery-event-stack-management/ The plugin is currently very basic and only allows you to insert a new event into a certain position in the stack. The logic is there for this plugin to do more, and I'll probably make it a bit more robust later, but this current version of the plugin should allow you to do what you need for your project. I added some demo testing stuff at the bottom to demonstrate how it should function. You'll need a browser with console.log() capabilities to get the gist of things. Also, a few quick notes: * You can bind custom events, regular events, and custom and regular events with namespaces (which I suggest you use to help in unbinding) * If you attempt to put an event at a certain position in the call stack, and that position doesn't exist (i.e., you attempt to bind a new click event to the 5th position in a stack of 3 elements), it will just bind the event regularly. * The stack is zero-indexed, meaning the first element in the stack is position 0, not position 1. * The demo text at the bottom is using a custom event clickr with some namespaces for testing. This was just to confirm that the plugin worked for custom events as well. If you make all the clickr events click, and unbind the click event which triggers clickr events, you will get the same result. Hope you find it useful! Let me know if you run into any issues. On Mar 27, 3:54 pm, deltaf j...@deltafactory.com wrote: It's potentially a pain, but if you know all of the events bound to it, you could unbind, add your event, then add all of the others. I too wish there was an easy way to view/modify the event stack... Best of luck.
[jQuery] Re: jQuery + PHP Form Validation
The best way is to use JSON as the dataType. In PHP, all you need to use is the json_encode() function to convert a PHP array to JSON. It's like an easy way to pass back an array full of data back to the client that you can manipulate as regular Javascript variables. For example, your PHP code would look like: $myArray = array( 'firstName' = 'John', 'lastName' = 'Doe', 'error' = 0 ); echo json_encode($myArray); // echo your response back exit; Then in your $.ajax success callback function: function(data) { alert(data.firstName); // - alerts 'John' } On Mar 27, 12:34 pm, Link ryanwjack...@gmail.com wrote: So I am working on an AJAX call to a PHP script which validates the data submitted in a form. My question concerns the best way to get the data from PHP back to the jQuery script. Should the dataType field be html or script? I tried html and I know I could parse out what I need, but in the documentation it says script runs the code as a javascript script, but I'm not sure of the scope of this script. I tried setting a variable name in the script and changing a global variable value, but I saw no change when I displayed the value with alert(). Am I missing something? Code below: $.ajax({ type: POST, url: /register/index.php?action=validate, data: email=+ email + pass1= + pass1, dataType: script,//html, complete: function (XMLHttpRequest, textStatus) { alert(complete); }, success: function(del){ alert(success); alert(del); alert(email); $(#email).addClass(error); /*$('form#submit').hide(); $('div.success').fadeIn();*/ }, error: function (xhr, desc, exceptionobj) { alert(error); //alert(xhr.responseText); alert(exceptionobj); } }); I can make the PHP file return whatever I want. What is the best in this situation? Thanks!
[jQuery] Re: Cycle plugin adds white background in ie6 and ie7
Hi. Thanks for the tip. Removing the cleartype solves the issue but indeed the text is ugly (I'm using Cycle on paragraphs of text). Actually, instead of removing cleartype, I just added the CSS rule background: transparent !important; on paragraphs, because I discovered that on IE7/8 a background-color is added. Best regards. On 25 mar, 23:15, Mike Alsup mal...@gmail.com wrote: It might have something to do with cleartype option. Try setting the cleartype to false: $('#slideshow').cycle({ cleartype: false }); On Mar 25, 6:09 pm, Merindol rndme...@gmail.com wrote: I have the same problem, but it's not white : it's the same color as the first parent that has its background-color defined. As a workaround I added background: transparent !important; to the cycled blocks. But that doesn't help to find where the problem is. Regards. On 25 mar, 02:26, Smoggy nate.scave...@gmail.com wrote: For some strange reason in IE I get a white background added to my li tag each li has a transparent background PNG image. So it get white corners where I should see a nice textured background basically cycle changes the header of the site. which is rounded on the top works fine in both FF and safari. any ideas where the white background is coming from and how to fix it. If I remove the cycle js it works correctly. if i use the IE developer tool bar the inline style on the li looks like this. LI class=relaxed png style=DISPLAY: block; Z-INDEX: 6; LEFT: 0px; ZOOM: 1; POSITION: absolute; TOP: 0px; BACKGROUND-COLOR: #ff cycleH=378 cycleW=919 jQuery1237943038750=5 I checked a different site I created and it was fine no background color applied in IE
[jQuery] Re: Cycle plugin adds white background in ie6 and ie7
Thanks for the tip. Removing the cleartype solves the issue but indeed the text is ugly (I'm using Cycle on paragraphs of text). Actually, instead of removing cleartype, I just added the CSS rule background: transparent !important; on paragraphs, because I discovered that on IE7/8 a background-color is added. Actually, you can probably solve it by setting the 'cleartypeNoBg' option to false. I always forget about that one. Cheers!
[jQuery] Re: JQuery and PS3?
Richard D. Worth wrote: Looks like no: http://groups.google.com/group/jquery-en/browse_thread/thread/739175c128a6f633 - Richard On Fri, Mar 27, 2009 at 4:33 PM, superaktieboy superaktie...@gmail.comwrote: Hi I was just wondering whether Jquery works on the PS3 natively (even if limited) and if not, how to do so? thanks I see... thanks for the info.. do you think there would ever be an special version for the ps3 or the psp?
[jQuery] Re: bind to front of event stack
Eric, Nice work! I just did a quick test and it appears that once the override event is inserted into the stack, it bumps the event it's replacing to the end. That is, if I insert it at position 0, and then unbind it, the event firing order is now 2,3,4,1. Same if I insert it into position one, events are then restored to 1,3,4,2. Michael On Mar 27, 4:38 pm, Eric Garside gars...@gmail.com wrote: I've come up with a little plugin that will allow you to bind any event (including custom ones) into a specified position in the event stack. http://snipplr.com/view/13515/jstack--jquery-event-stack-management/ The plugin is currently very basic and only allows you to insert a new event into a certain position in the stack. The logic is there for this plugin to do more, and I'll probably make it a bit more robust later, but this current version of the plugin should allow you to do what you need for your project. I added some demo testing stuff at the bottom to demonstrate how it should function. You'll need a browser with console.log() capabilities to get the gist of things. Also, a few quick notes: * You can bind custom events, regular events, and custom and regular events with namespaces (which I suggest you use to help in unbinding) * If you attempt to put an event at a certain position in the call stack, and that position doesn't exist (i.e., you attempt to bind a new click event to the 5th position in a stack of 3 elements), it will just bind the event regularly. * The stack is zero-indexed, meaning the first element in the stack is position 0, not position 1. * The demo text at the bottom is using a custom event clickr with some namespaces for testing. This was just to confirm that the plugin worked for custom events as well. If you make all the clickr events click, and unbind the click event which triggers clickr events, you will get the same result. Hope you find it useful! Let me know if you run into any issues. On Mar 27, 3:54 pm, deltaf j...@deltafactory.com wrote: It's potentially a pain, but if you know all of the events bound to it, you could unbind, add your event, then add all of the others. I too wish there was an easy way to view/modify the event stack... Best of luck.
[jQuery] IDE for JQuery?
which IDE is best for JQuery? i mean like has code completion for JQuery, at least HTML, CSS, JavaScript. best if it can also code complete PHP/Zend Framework. or your custom classes. Aptana can code complete for all except Zend Framework isit? but i saw a video i can add zend framework as a library... then it shld have code completion for Zend Framework as well?
[jQuery] Re: [autocomplete] - Request
Hi Brian, I created ticket number 4407 if you want to add comments to it: http://dev.jqueryui.com/ticket/4407 On Mar 26, 7:39 pm, brian bally.z...@gmail.com wrote: Adding to that, it might be nice to have the option to specify a callback that would fire when no further results are possible. For example, to add a class name to the input that would change the BG color. Or, in *some* cases, one might want further typing to be blocked. On Thu, Mar 26, 2009 at 7:19 PM,freeav8rfreea...@yahoo.com wrote: np On Mar 26, 6:05 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Could you file this as a ticket?http://dev.jqueryui.com/newticket (requires registration/login) Jörn On Thu, Mar 26, 2009 at 11:13 PM,freeav8rfreea...@yahoo.com wrote: Hi, I have an autocomplete feature request. My request is that when a particular prefix is not found on the database, adding to the prefix should not cause more calls to the remote system: As an example, say I type in ThisIsANewEntry, the following might happen: T - 5 entries returned Th - 3 entries returned Thi - 0 entries returned This - 0 entries returned ThisI - 0 entries returned ThisIs - 0 entries returned . . . Once the jQuery sees that a prefix isn't returning anything more, I'd like jQuery to stop trying.
[jQuery] Re: jQuery + PHP Form Validation
Just out of curiosity, is this typically the best way? On Mar 27, 7:46 pm, James james.gp@gmail.com wrote: The best way is to use JSON as the dataType. In PHP, all you need to use is the json_encode() function to convert a PHP array to JSON. It's like an easy way to pass back an array full of data back to the client that you can manipulate as regular Javascript variables. For example, your PHP code would look like: $myArray = array( 'firstName' = 'John', 'lastName' = 'Doe', 'error' = 0 ); echo json_encode($myArray); // echo your response back exit; Then in your $.ajax success callback function: function(data) { alert(data.firstName); // - alerts 'John' } On Mar 27, 12:34 pm, Link ryanwjack...@gmail.com wrote: So I am working on an AJAX call to a PHP script which validates the data submitted in a form. My question concerns the best way to get the data from PHP back to the jQuery script. Should the dataType field be html or script? I tried html and I know I could parse out what I need, but in the documentation it says script runs the code as a javascript script, but I'm not sure of the scope of this script. I tried setting a variable name in the script and changing a global variable value, but I saw no change when I displayed the value with alert(). Am I missing something? Code below: $.ajax({ type: POST, url: /register/index.php?action=validate, data: email=+ email + pass1= + pass1, dataType: script,//html, complete: function (XMLHttpRequest, textStatus) { alert(complete); }, success: function(del){ alert(success); alert(del); alert(email); $(#email).addClass(error); /*$('form#submit').hide(); $('div.success').fadeIn();*/ }, error: function (xhr, desc, exceptionobj) { alert(error); //alert(xhr.responseText); alert(exceptionobj); } }); I can make the PHP file return whatever I want. What is the best in this situation? Thanks!
[jQuery] Re: bind to front of event stack
Yea, it swaps positions and the latest element will always move to the end of the stack, so you have knowledge of its position. On Mar 27, 9:12 pm, mkmanning michaell...@gmail.com wrote: Eric, Nice work! I just did a quick test and it appears that once the override event is inserted into the stack, it bumps the event it's replacing to the end. That is, if I insert it at position 0, and then unbind it, the event firing order is now 2,3,4,1. Same if I insert it into position one, events are then restored to 1,3,4,2. Michael On Mar 27, 4:38 pm, Eric Garside gars...@gmail.com wrote: I've come up with a little plugin that will allow you to bind any event (including custom ones) into a specified position in the event stack. http://snipplr.com/view/13515/jstack--jquery-event-stack-management/ The plugin is currently very basic and only allows you to insert a new event into a certain position in the stack. The logic is there for this plugin to do more, and I'll probably make it a bit more robust later, but this current version of the plugin should allow you to do what you need for your project. I added some demo testing stuff at the bottom to demonstrate how it should function. You'll need a browser with console.log() capabilities to get the gist of things. Also, a few quick notes: * You can bind custom events, regular events, and custom and regular events with namespaces (which I suggest you use to help in unbinding) * If you attempt to put an event at a certain position in the call stack, and that position doesn't exist (i.e., you attempt to bind a new click event to the 5th position in a stack of 3 elements), it will just bind the event regularly. * The stack is zero-indexed, meaning the first element in the stack is position 0, not position 1. * The demo text at the bottom is using a custom event clickr with some namespaces for testing. This was just to confirm that the plugin worked for custom events as well. If you make all the clickr events click, and unbind the click event which triggers clickr events, you will get the same result. Hope you find it useful! Let me know if you run into any issues. On Mar 27, 3:54 pm, deltaf j...@deltafactory.com wrote: It's potentially a pain, but if you know all of the events bound to it, you could unbind, add your event, then add all of the others. I too wish there was an easy way to view/modify the event stack... Best of luck.
[jQuery] Re: jQuery + PHP Form Validation
Currently, I believe so. Prior to that was probably using XML (the intent of AJAX's XMLHttpRequest), but it required a lot of work needing to drill down to reading the content, and the response size of XML was fairly large due to all the XML tags required. JSON doesn't use such structural tags, so less overhead and the response size is generally very small because of it (thus, your application get a response quicker). JSON is already a Javascript object format so you can very easily reference its content without needing to parse (much) the data. Many dynamic AJAX applications already uses JSON as the response data type. For example, Gmail. On Mar 27, 4:19 pm, Link ryanwjack...@gmail.com wrote: Just out of curiosity, is this typically the best way? On Mar 27, 7:46 pm, James james.gp@gmail.com wrote: The best way is to use JSON as the dataType. In PHP, all you need to use is the json_encode() function to convert a PHP array to JSON. It's like an easy way to pass back an array full of data back to the client that you can manipulate as regular Javascript variables. For example, your PHP code would look like: $myArray = array( 'firstName' = 'John', 'lastName' = 'Doe', 'error' = 0 ); echo json_encode($myArray); // echo your response back exit; Then in your $.ajax success callback function: function(data) { alert(data.firstName); // - alerts 'John' } On Mar 27, 12:34 pm, Link ryanwjack...@gmail.com wrote: So I am working on an AJAX call to a PHP script which validates the data submitted in a form. My question concerns the best way to get the data from PHP back to the jQuery script. Should the dataType field be html or script? I tried html and I know I could parse out what I need, but in the documentation it says script runs the code as a javascript script, but I'm not sure of the scope of this script. I tried setting a variable name in the script and changing a global variable value, but I saw no change when I displayed the value with alert(). Am I missing something? Code below: $.ajax({ type: POST, url: /register/index.php?action=validate, data: email=+ email + pass1= + pass1, dataType: script,//html, complete: function (XMLHttpRequest, textStatus) { alert(complete); }, success: function(del){ alert(success); alert(del); alert(email); $(#email).addClass(error); /*$('form#submit').hide(); $('div.success').fadeIn();*/ }, error: function (xhr, desc, exceptionobj) { alert(error); //alert(xhr.responseText); alert(exceptionobj); } }); I can make the PHP file return whatever I want. What is the best in this situation? Thanks!