[jQuery] Re: Read ajax response headers?
try to change the paramater name inside the success function, to something like xhr, for example: ... success:function (data,xhr) {} complele:function (xhr) {} .. You uses XMLHttpRequest. Maybe the browser think about the native object. On Jan 13, 9:16 pm, bryan br...@resenmedia.com wrote: Read ajax response headers? How can I grab information from the response headers from within an jQuery ajax callback? I have an object, data, containing IDs to different items I'd like to build a detailed list with. I need to grab these details by sending a request to a server--one for each item. The issue I'm running into, is the response from the server contains half the information I need in the body of the response, and the other half in the headers. I can't figure out a bullet-proof way of reading the headers at the same time as the body... Here's a look at what I'm working with: function index(data) { for (var i = 0; i data.length; i++) { $.ajax({ type: 'GET', url: 'http://domain.com/', data: 'this=that', success: function(data) { /* Here I want to create a list item out of the data returned in the body and headers */ }, complete: function(XMLHttpRequest, textStatus) { }, error: function() { } }); } } I've tried saving the $.ajax as a variable, and using .getResponseHeader('name'), but that only works sometimes, and other times returns Error: INVALID_STATE_ERR: DOM Exception 11, which apparently means the headers aren't ready to be read. I've tried this both in the success and complete function. Any help would be incredibly awesome!
[jQuery] Re: javascript loaded via ajax
Yes. Two options. 1. to remove function from the DOM: window.functionname=null; 2. To create one-time functions, like: (function (){ function a() {alert('a')} function b() {alert('b')} function c() {a();b();} })(); the function a,b,c are relase after they run. OR (function (){ a=function() {alert('a')} b=function() {alert('b')} c=function() {a();b();} })(); On Jan 13, 9:53 pm, nihal nihal.c...@gmail.com wrote: hi i have a div whose content is loaded via ajax..that content contains html+javascript the javascript contains a function called test() when the content is loaded this function is added to the dom...now when i remove the div using remove(); i am still able to run the function test() as its still in the dom is there anyway to remove the newly added function from the dom? thanks for your help
[jQuery] Re: Finding next element
$('.active').prev() $('.active').next() Rate me please if I helped. On Dec 28, 2:30 am, Toaster mr.toas...@gmail.com wrote: Hello. Example: ul lia/li lia class=active/li lia/li /ul How would I be able to get find the next or previous a in relation to the a class=active? I'd appreciate it if anybody could help me out with this. Thanks in advance.
[jQuery] Re: I would like to get value each time when one of these checkboxes will change status, how can I do that ?
I recommend to use change event and not click event, becuase users can change the checkbox without clicking (by using the keyboard). On Dec 28, 1:17 am, Charlie Griefer charlie.grie...@gmail.com wrote: You just want the value of the one that's checked? $(':checkbox[name=number]').click(function() { if ($(this).is(':checked')) alert($(this).val()); }); if you want the total of all checked boxes when one is clicked: script type=text/javascript $(document).ready(function() { $(':checkbox[name=number]').click(function() { var total = 0; $(':checkbox[name=number]:checked').each(function() { total += parseFloat($(this).val()); }); alert(total); }); }); /script On Sun, Dec 27, 2009 at 1:08 PM, dziobacz aaabbbcccda...@gmail.com wrote: I have: input type=checkbox checked=checked value=2 name=number/ input type=checkbox value=7 name=number/ input type=checkbox value=34 name=number/ I would like to get value each time when one of these checkboxes will change status, how can I do that ? For example when first checkbox will be unchecked or second will be checked. Could You help me ? -- Charlie Grieferhttp://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: The form is not submitted onKeyDown
Try that: $(document).keydown (function (e) { if (e.ctrlKey e.which==13) { $('#myform').trigger('submit') }) Let me know if it's work. On Dec 27, 6:59 pm, Andre Polykanine an...@oire.org wrote: Hello everyone, I'm trying to sumbit the form normally as well as by pressing Ctrl+Enter. Yepp, the same task. What I'm doing is the following: var validator=$(#myform).validate( { // tralala, here go the rules, error messages and stuff }); $(document).keydown (function (e) { if (e.ctrlKey e.which==13) { validator.form(); } }); then I'm trying to submit. If I do something wrong (for example, leave a required field blank) and press Ctrl+Enter, Validator gently tells me that yes, that field is required, go on and fill it in. But if I fill in the field and do everything correctly, pressing Ctrl+Enter gives absolutely nothing: no errors and no submit. the simple click on the Submit button, however, does give the expected result. Where am I wrong? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule
[jQuery] Re: Function call
function slide() { if ($(slide_img).attr(src)!=images/1.jpg){ $(slide_img).fadeOut(200,function() { $(slide_img).attr({src:images/1.jpg}); $(slide_img).fadeIn(200); });} } OR use can use this like: function slide() { if ($(this).attr(src)!=images/1.jpg){ $(this).fadeOut(200,function() { $(this).attr({src:images/1.jpg}); $(this).fadeIn(200); });} } On Dec 26, 11:22 pm, Funktastik crazy.bib...@gmail.com wrote: Hi, I wrote some lines to make an element fade in out when HOVER another text this is my script: $(sw1).hover(function () { if ($(slide_img).attr(src)!=images/1.jpg){ $(slide_img).fadeOut(200,function() { $(slide_img).attr({src:images/1.jpg}); $(slide_img).fadeIn(200); } );} },function(event){ /* NOTHING HERE */ } ); I want to define a function named slide then call it when HOVER like this: $(sw1).hover(slide(),function(event){ /* NOTHING HERE */ } ); what should i write ???
[jQuery] Re: [AUTOCOMPLETE]
Yes. try that: $('select').focus( function (){$(this).attr('size',5)} ).blur( function (){$(this).attr('size',0)} ) If it.. rate me please. On Dec 23, 9:47 pm, Jake Moon jmalon...@gmail.com wrote: Is it possible to open the select list on focus? Best regards, Jake Moon
[jQuery] Re: Change this when binding element
I get an answer from John: http://groups.google.com/group/jquery-dev/msg/9345d498c4a1d5f5 On Dec 23, 5:05 pm, Ami aminad...@gmail.com wrote: One solution is to use the data property like: function myObj() { document.bind('scroll',this,this.myScroll); this.myScroll=function (data) { //Now I am trying to get this.a alert(data.a)} } But I am sure that changing the scope will work better. On Dec 23, 5:03 pm, Ami aminad...@gmail.com wrote: I am suggestion for new small feaute in jQuery. add a new proeprty to bind function. a Scope property. sometimes I am binding a function inside object. So I need a solution to change the scope of this function. something like: $().bind('click',data,scope,function) For Example: function myObj() { this.a='1' document.bind('scroll',this.myScroll); this.myScroll=function () { //Now I am trying to get this.a alert(this.a)} //This is make an error becuase this is an HtmlElement and not THIS object} var a=new myObj();
[jQuery] Change this when binding element
I am suggestion for new small feaute in jQuery. add a new proeprty to bind function. a Scope property. sometimes I am binding a function inside object. So I need a solution to change the scope of this function. something like: $().bind('click',data,scope,function) For Example: function myObj() { this.a='1' document.bind('scroll',this.myScroll); this.myScroll=function () { //Now I am trying to get this.a alert(this.a)} //This is make an error becuase this is an HtmlElement and not THIS object } var a=new myObj();
[jQuery] Re: Change this when binding element
One solution is to use the data property like: function myObj() { document.bind('scroll',this,this.myScroll); this.myScroll=function (data) { //Now I am trying to get this.a alert(data.a)} } But I am sure that changing the scope will work better. On Dec 23, 5:03 pm, Ami aminad...@gmail.com wrote: I am suggestion for new small feaute in jQuery. add a new proeprty to bind function. a Scope property. sometimes I am binding a function inside object. So I need a solution to change the scope of this function. something like: $().bind('click',data,scope,function) For Example: function myObj() { this.a='1' document.bind('scroll',this.myScroll); this.myScroll=function () { //Now I am trying to get this.a alert(this.a)} //This is make an error becuase this is an HtmlElement and not THIS object} var a=new myObj();
[jQuery] Get the element that I bind to live()
This is my Html: I am trying to get the element that I binded to live(), but always i am getting it's children. For example, this is my code: div id=div1 class=theClassbHye/b/div div id=div2 class=theClasspHello/p/div div id=div3 class=theClassdivbHello World/b/div/div /div script $('.theClass').live('click', function () { alert('I am trying to get the parent div id' + this.id + ', but i am always get the child element of the div')]) /script
[jQuery] Re: multiple conditions?
var divFocus=false,textareaFocus=false $('div').focus(function () {divFocus=true}).blur(function() {divFocus=false;doSomething()}; $('textarea').focus(function () {textareafocus=true}).blur(function() {textareaFocus=false;doSomething()} function doSomthing() { if (!divFocus !textAreaFocus) alert('There is no focus on the divtextarea') } Hope it's help you. Aminadav On Mar 2, 4:38 am, homien...@gmail.com homien...@gmail.com wrote: I have a div with a textbod inside of it. When both of these lose focus, so the focus is not on either of them, then I want the div to move. How would I write the code that if both of these lose focus, THEN do whatever i want. I just want to know how to have 2 selectors, and when both of them lose focus, then do something. i'm probably missing the obvious... it's been a long day. thanks!
[jQuery] Re: parent load question
Try to put div between td and #myelemnt table trtddivdiv id=myelementnbsp;/div/div/td/tr /table Aminadav On Mar 2, 4:15 am, joshm joshmat...@gmail.com wrote: Can someone explain how to do this, I'm trying to load the parent of an element (which will be a td cell) and then load the td with the html from a remote file kind of like so: var parent = $('#myelement').parent().load('http://test.com/ remote.html'); I have tried several other variations and the load always fails...no error messages, just doesn't seem to like it. It may have something to do with it still being a jquery object perhaps?
[jQuery] Re: Slideshow Using Ajax
There is no way to load images in AJAX. AJAX is only for text (Like JS/ CSS/JSON/XML,...) You can use AJAX to load the image source, and put it in img src=, or div style=background-image:url( On Mar 2, 5:53 am, Nic Hubbard nnhubb...@gmail.com wrote: I have been searching for a jQuery slideshow plugin that can load in images using ajax. But I am having a really hard time finding one. Does anyone have any recommendations for one?
[jQuery] Re: parent load question
If it's not on the same domain you must use JSONP. On Mar 2, 7:27 am, mkmanning michaell...@gmail.com wrote: I'll go ahead and ask this here as well: is 'http://test.com/ remote.html' in the same domain? On Mar 1, 8:55 pm, Ami aminad...@gmail.com wrote: Try to put div between td and #myelemnt table trtddivdiv id=myelementnbsp;/div/div/td/tr /table Aminadav On Mar 2, 4:15 am, joshm joshmat...@gmail.com wrote: Can someone explain how to do this, I'm trying to load the parent of an element (which will be a td cell) and then load the td with the html from a remote file kind of like so: var parent = $('#myelement').parent().load('http://test.com/ remote.html'); I have tried several other variations and the load always fails...no error messages, just doesn't seem to like it. It may have something to do with it still being a jquery object perhaps?
[jQuery] Suggestion: .unbind('.eventname)
Suggestion: .unbind('.event-title) $('div').bind('click.mybind',func1).bind('focus.mybind',func2).bind ('click,func3) Now I am trying to unbind func1 func2 like: $('div').unbind('click.mybind').unbind('focus.mybind'); My suggestion is that jQuery will support this: $('div').unbind('.mybind') What do you think?
[jQuery] Re: Suggestion: .unbind('.eventname)
I check the jQuery code, and I see that it's already supported. (From jQuery-1.3.2.js File) if ( types === undefined || (typeof types === string types.charAt (0) == .) ) for ( var type in events ) this.remove( elem, type + (types || ) ); Thank you On Feb 26, 5:19 am, Ami aminad...@gmail.com wrote: Suggestion: .unbind('.event-title) $('div').bind('click.mybind',func1).bind('focus.mybind',func2).bind ('click,func3) Now I am trying to unbind func1 func2 like: $('div').unbind('click.mybind').unbind('focus.mybind'); My suggestion is that jQuery will support this: $('div').unbind('.mybind') What do you think?
[jQuery] Suggestion code: Toggle not only to click
Hello. Some times we need to make toggle not only to click events. So I change the jQuery Code at line 2993-2954 to: toggle: function( fn ) { // Save reference to arguments for access in closure var args = arguments, i = 1; //I added This 2 lines:* var event='click'; if (!$.isFunction(fn)) {event=fn;fn=args [1];args=Array.prototype.slice.call( args,1 ) } // link all the functions, so any of them can unbind this click handler while( i args.length ) jQuery.event.proxy( fn, args[i++] ); //I changed The next line:* return this[event]( jQuery.event.proxy( fn, function(event) { // Figure out which function to execute this.lastToggle = ( this.lastToggle || 0 ) % i; // Make sure that clicks stop event.preventDefault(); // and execute the function return args[ this.lastToggle++ ].apply( this, arguments ) || false; })); }, //-- It's worked great for me, when I am using this code: $('button')._toggle('mouseover', function(){alert(0)}, function(){alert(1)} ) Do you want to accept this change? I didn't success to set the normal $().toogle function to work (only _toggle), becuase jQuery think that I am trying to make a toggle animation. Thank you.
[jQuery] Re: Is A Child Of?
Thank you. It's was help me a lot. I am writing a small tooltip plugin, and I use it to now when the user click on an element inside the tooltip Thank you again. On 12 פברואר, 00:05, mkmanning michaell...@gmail.com wrote: I just wrote this in response to this thread and haven't checked it thoroughly (other than my head, which has been known to be buggy). I prefer to be able to pass in a jQuery object as the parent: jQuery.fn.childOf = function(a){ return (this.length === this.map(function(){if($.inArray (this,a.children())!=-1){return this;}}).length); }; Test in Firebug: div id=gramps ul id=pops li id=kid1span id=subkid1one/span/li li id=kid2span id=subkid2two/span/li li id=kid3span id=subkid3three/span/li li id=kid4span id=subkid4four/span/li /ul /div console.log( $('#kid1, #kid2, #kid3').childOf( $('#gramps') ) ); // logs false console.log( $('#kid1, #kid2, #kid3').childOf( $('#pops') ) ); //logs true console.log( $('#kid1, #kid2, #kid3, #subkid3').childOf( $ ('#pops') ) ); //logs false console.log( $('#pops').childOf( $('#gramps') ) ); //logs true console.log( $('#pops').childOf( $('#pops') ) ); //logs false On Feb 11, 1:45 pm, Ricardo Tomasi ricardob...@gmail.com wrote: 'return true' inside the each callback works like a 'continue', skipping to next iteration. The value is never returned to the outside scope (would break chaining). cheers, - ricardo On Feb 11, 6:33 pm, Ami aminad...@gmail.com wrote: You can shave a few ms, and memory: *** jQuery.fn.childOf = function(a){ this.each(function(){ if (this.parentNode == a) return true; }); return false;}); *** On Feb 11, 8:18 pm, Ricardo Tomasi ricardob...@gmail.com wrote: You can shave a few ms off that by using the current object itself, and cacheing the other element: jQuery.fn.in = function(a){ var a = $(a)[0]; return !!this.parents().filter(function(){ return this === a;}).length; }; Also be aware that this actually checks if the element is a *descendant* of the other, not just achild. For a simple (and faster) 'childOf' check use this: jQuery.fn.childOf = function(a){ var p = false; this.each(function(){ if (this.parentNode == a) p = true; }); return p; }; cheers, - ricardo On Feb 11, 1:56 pm, Ami aminad...@gmail.com wrote: The Best solution: I have writed a very small plugin (1 line) for that, by using the code of Richard jQuery.fn.childOf=function(a){var b=this;return ($(b).parents().filter (function() { return this === $(a)[0]; }).length )} For Example: $(div).childOf(document.body) $(div).childOf($(document.body)) I hope that there is no bugs in this code. On 22 ינואר, 11:25, James Hughes j.hug...@kainos.com wrote: Hi, This is probably a really easy question an I apologise if it appear stupid but I am clueless right now. Given 2 jQuery objects (a,b) how can I tell if b is achildof a? James This e-mail is intended solely for the addressee and is strictly confidential; if you are not the addressee please destroy the message and all copies. Any opinion or information contained in this email or its attachments that does not relate to the business of Kainos is personal to the sender and is not given by or endorsed by Kainos. Kainos is the trading name of Kainos Software Limited, registered in Northern Ireland under company number: NI19370, having its registered offices at: Kainos House, 4-6 Upper Crescent, Belfast, BT7 1NT, Northern Ireland. Registered in the UK for VAT under number: 454598802 and registered in Ireland for VAT under number: 9950340E. This email has been scanned for all known viruses by MessageLabs but is not guaranteed to be virus free; further terms and conditions may be found on our website -www.kainos.com
[jQuery] Re: $(element in other iframe)
Thank you. You write that I need to wait until the iframe has been loaded. So I can do this? var frame=$(#iframe)[0].contentdocument; $(frame).ready(function () { alert('Iframe has been loaded!'); }); Am I right? and Thank you again. On Feb 8, 6:07 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi Ami you can access an iframe with: var frame = window.frames[0].document; -or- var frame = $(#iframe)[0].contentDocument; var div = $(div, frame); just remember to wait until the iframe has been loaded. by(e) Stephan 2009/2/8 Ami aminad...@gmail.com: Can I use jQuery to work with elements in other frames? For Example: html iframe id=frame1/iframe script $(#frame1 document) OR $(document, $(#frame1)) /script
[jQuery] Re: Is A Child Of?
The Best solution: I have writed a very small plugin (1 line) for that, by using the code of Richard jQuery.fn.childOf=function(a){var b=this;return ($(b).parents().filter (function() { return this === $(a)[0]; }).length )} For Example: $(div).childOf(document.body) $(div).childOf($(document.body)) I hope that there is no bugs in this code. On 22 ינואר, 11:25, James Hughes j.hug...@kainos.com wrote: Hi, This is probably a really easy question an I apologise if it appear stupid but I am clueless right now. Given 2 jQuery objects (a,b) how can I tell if b is a child of a? James This e-mail is intended solely for the addressee and is strictly confidential; if you are not the addressee please destroy the message and all copies. Any opinion or information contained in this email or its attachments that does not relate to the business of Kainos is personal to the sender and is not given by or endorsed by Kainos. Kainos is the trading name of Kainos Software Limited, registered in Northern Ireland under company number: NI19370, having its registered offices at: Kainos House, 4-6 Upper Crescent, Belfast, BT7 1NT, Northern Ireland. Registered in the UK for VAT under number: 454598802 and registered in Ireland for VAT under number: 9950340E. This email has been scanned for all known viruses by MessageLabs but is not guaranteed to be virus free; further terms and conditions may be found on our website -www.kainos.com
[jQuery] Re: Is A Child Of?
You can shave a few ms, and memory: *** jQuery.fn.childOf = function(a){ this.each(function(){ if (this.parentNode == a) return true; }); return false; }); *** On Feb 11, 8:18 pm, Ricardo Tomasi ricardob...@gmail.com wrote: You can shave a few ms off that by using the current object itself, and cacheing the other element: jQuery.fn.in = function(a){ var a = $(a)[0]; return !!this.parents().filter(function(){ return this === a;}).length; }; Also be aware that this actually checks if the element is a *descendant* of the other, not just achild. For a simple (and faster) 'childOf' check use this: jQuery.fn.childOf = function(a){ var p = false; this.each(function(){ if (this.parentNode == a) p = true; }); return p; }; cheers, - ricardo On Feb 11, 1:56 pm, Ami aminad...@gmail.com wrote: The Best solution: I have writed a very small plugin (1 line) for that, by using the code of Richard jQuery.fn.childOf=function(a){var b=this;return ($(b).parents().filter (function() { return this === $(a)[0]; }).length )} For Example: $(div).childOf(document.body) $(div).childOf($(document.body)) I hope that there is no bugs in this code. On 22 ינואר, 11:25, James Hughes j.hug...@kainos.com wrote: Hi, This is probably a really easy question an I apologise if it appear stupid but I am clueless right now. Given 2 jQuery objects (a,b) how can I tell if b is achildof a? James This e-mail is intended solely for the addressee and is strictly confidential; if you are not the addressee please destroy the message and all copies. Any opinion or information contained in this email or its attachments that does not relate to the business of Kainos is personal to the sender and is not given by or endorsed by Kainos. Kainos is the trading name of Kainos Software Limited, registered in Northern Ireland under company number: NI19370, having its registered offices at: Kainos House, 4-6 Upper Crescent, Belfast, BT7 1NT, Northern Ireland. Registered in the UK for VAT under number: 454598802 and registered in Ireland for VAT under number: 9950340E. This email has been scanned for all known viruses by MessageLabs but is not guaranteed to be virus free; further terms and conditions may be found on our website -www.kainos.com
[jQuery] $(element in other iframe)
Can I use jQuery to work with elements in other frames? For Example: html iframe id=frame1/iframe script $(#frame1 document) OR $(document, $(#frame1)) /script
[jQuery] Re: Detecting variable passed by # in URL
Jquery History plugin can help you. The problem is that no event trigger when the user change the hash value. On Jan 28, 4:45 am, MorningZ morni...@gmail.com wrote: You can read the hash value by location.hash http://www.devguru.com/Technologies/ecmascript/quickref/location_hash... Not really sure where/how you feel jQuery would be involved, but ultimately jQuery would get that value via that JavaScript method On Jan 27, 4:37 pm, vdiddy iloveblendedeve...@gmail.com wrote: I've seen Flash be able to be triggered by passing a variable or sectionname through the URL after the #. For example, if I go tohttp://www.site.com/#aboutitwould trigger flash movie for about section, andhttp://www.site.com/#contactwouldtrigger the contact section of the flash. My question is would you be able to do this with jquery too? How do I pass a variable through from one page to another easily, possibly by using #?
[jQuery] Re: $.live and performance
Thank you On Jan 23, 6:08 pm, Ricardo Tomasi ricardob...@gmail.com wrote: Live uses event delegation. It will capture events on the 'document' element and then find out which element was clicked, if it matches 'span[attr=value]' then your function is called. Read all about it at the docs:http://docs.jquery.com/Events/live On Jan 23, 3:13 am, Ami aminad...@gmail.com wrote: Hello. Sorry about my grammar, English isn't my tang. I want to understand how the $(selector).live() works. I have a DOM with a lot of elements. So if I write: $('span[attr=value]').live('click').. When jQuery search for this SPAN? jQuery search immediately for all span[attr=value], or every time that I click on any element jQuery check if it span[att=value]?
[jQuery] Re: How to get the value of List and concatenate with JQUERY
It's is a bug. I copypaste you code, and I see an alert 123. You can simple try it, buy paste this code in FireBug console in any website that support jQuery (like jQuery.com) On Jan 23, 5:14 pm, nk neetuk...@gmail.com wrote: Hi Ami, Thanks for your response. I am still not getting the value. Please let me know what is wrong with the following code.I am getting a blank alert message at the beginning. script type=text/javascript $(document.body).prepend(ul id=theUlli id=1abc/lili id=2def/lili id=3ghi/li/ul); var result=''; $.each ( $(#theUl).children(), function () {result+=($(this).attr('id'))} ); alert(result); /script the body tag has the following fieldset legendCollapsible List mdash; Take 3/legend !--- ul id=theUl li id=1abc/lili id=2def/ lili id=3ghi/li/ul /fieldset NK On Jan 22, 8:45 pm, Ami aminad...@gmail.com wrote: My javascript syntax is better than my English syntax, So i hope that you can understand it $(document.body).prepend(ul id=theUlli id=1abc/lili id=2def/ lili id=3ghi/li/ul); var result=''; $.each ( $(#theUl).children(), function () {result+=($(this).attr('id'))} ); alert(result); Good luck, Ami On Jan 23, 12:38 am, nk neetuk...@gmail.com wrote: Hi All, I have a list which is being populated dynamically from the database.I am trying to capture the value of the list items (using click function) and pass it to a query to get the result set.The value attribute has been deprecated for LI.Please tell me a way to capture the LI value. ul id=developerul li value='1'One/li li value='2'Two/li li value='3'three/li /ul For the above I have tried $(#developerul.children()) and also $(this).children() But does not work. - And also how can we concatenate a ID value ID=thelistItems the result should be thelistItems_11130. $(#thelistItems+ _ + 11130).append(txt); Thanks
[jQuery] Re: jquery.ajax question.
You can't do it by using $.load. You can do it by using $.ajax, and set the dataType to 'script' For example: div id=box1/div div id=box2/div script type=text/javascript $(function () { $.ajax ({ url:'url.php', dataType: 'script' }); }); PHP Respone: $('#box1').html('Hello');$('#box2').html('World'); On 23 ינואר, 12:07, Trend-King i...@trend-king.de wrote: Hello i have a question about getting content via ajax. i make a ajax call to an seperate php file with will return me the content of the to be updated elements on a page. for example div id=box1the content goes there/div div id=box2the second content goes there/div how can i manage the ajax result to take these elements on the right place in the page. i want to update each element of the result replace #box1 with the #box1 from the ajax call and replace #box2 with the #box2 from the ajax call is this possible or i have to do a call each element? thanks for your replies Jens
[jQuery] Re: How to get the value of List and concatenate with JQUERY
My javascript syntax is better than my English syntax, So i hope that you can understand it $(document.body).prepend(ul id=theUlli id=1abc/lili id=2def/ lili id=3ghi/li/ul); var result=''; $.each ( $(#theUl).children(), function () {result+=($(this).attr('id'))} ); alert(result); Good luck, Ami On Jan 23, 12:38 am, nk neetuk...@gmail.com wrote: Hi All, I have a list which is being populated dynamically from the database.I am trying to capture the value of the list items (using click function) and pass it to a query to get the result set.The value attribute has been deprecated for LI.Please tell me a way to capture the LI value. ul id=developerul li value='1'One/li li value='2'Two/li li value='3'three/li /ul For the above I have tried $(#developerul.children()) and also $(this).children() But does not work. - And also how can we concatenate a ID value ID=thelistItems the result should be thelistItems_11130. $(#thelistItems+ _ + 11130).append(txt); Thanks
[jQuery] Re: Can't append html to textare after jquery.form ajax submit
You can try this. 1. Create this function: function bindButtons () { $('#bold,#italic,#underline').unbind().click(function() { $('#body').append($(this).val()); } 2. change the ready function: $(document).ready(function() { $('#journalForm').ajaxForm({ dataType: 'json', success: process }); function process(json) { blah blah blah irrelevant } bindButtons(); }); }); 3. Add this code to your submit event, for example: $.ajaxSubmit ( { success:bindButtons() }) On Jan 23, 12:00 am, drewtown drew.t...@gmail.com wrote: I am writing a user input form and I have buttons set up that add [b] [i][u] etc tags to the form like BBCode. The user can then submit it (uses the jquery.form plugin) and everything works fine. If the user then tries to type more and use the buttons again the buttons don't append to the textare anymore. Any ideas [code below] $(document).ready(function() { $('#journalForm').ajaxForm({ dataType: 'json', success: process }); function process(json) { blah blah blah irrelevant } $('#bold,#italic,#underline').click(function() { $('#body').append($(this).val()); }); });
[jQuery] Re: Can't append html to textare after jquery.form ajax submit
This is the code: function bindButtons () { $('#bold,#italic,#underline').unbind().click(function() { $('#body').append($(this).val()); } $(document).ready(function() { $('#journalForm').ajaxForm({ dataType: 'json', success: function () {process();bindButtons ()} }); function process(json) { blah blah blah irrelevant } bindButtons() }); }); On Jan 23, 3:49 am, Ami aminad...@gmail.com wrote: You can try this. 1. Create this function: function bindButtons () { $('#bold,#italic,#underline').unbind().click(function() { $('#body').append($(this).val()); } 2. change the ready function: $(document).ready(function() { $('#journalForm').ajaxForm({ dataType: 'json', success: process }); function process(json) { blah blah blah irrelevant } bindButtons(); }); }); 3. Add this code to your submit event, for example: $.ajaxSubmit ( { success:bindButtons() }) On Jan 23, 12:00 am, drewtown drew.t...@gmail.com wrote: I am writing a user input form and I have buttons set up that add [b] [i][u] etc tags to the form like BBCode. The user can then submit it (uses the jquery.form plugin) and everything works fine. If the user then tries to type more and use the buttons again the buttons don't append to the textare anymore. Any ideas [code below] $(document).ready(function() { $('#journalForm').ajaxForm({ dataType: 'json', success: process }); function process(json) { blah blah blah irrelevant } $('#bold,#italic,#underline').click(function() { $('#body').append($(this).val()); }); });
[jQuery] $.ajaxSubmit ( ERROR :
Hello. Do you think that there is a way to get a return code, when uploading file? form input type=file /form $(form).ajaxSubmit ( {error: function () {alert('error')} ); Now because the upload is by using invisible iframe and not by XHR, I think that I cannot get the error function to work. Am I right? I am using FireBug, and also when there is an error in the post, the error function not trigger (the newest jQuery ver) Thank you.
[jQuery] Re: $.ajaxSubmit ( ERROR :
Thank you. On Jan 23, 5:53 am, Mike Alsup mal...@gmail.com wrote: Do you think that there is a way to get a return code, when uploading file? form input type=file /form $(form).ajaxSubmit ( {error: function () {alert('error')} ); Now because the upload is by using invisible iframe and not by XHR, I think that I cannot get the error function to work. Am I right? I am using FireBug, and also when there is an error in the post, the error function not trigger (the newest jQuery ver) Yeah, errors are very difficult, if not impossible, to detect with the iframe approach. If you really want to inspect the response you can use a 'complete' handler and then grab the responseText from the (mock) XHR object. Mike
[jQuery] $.live and performance
Hello. Sorry about my grammar, English isn't my tang. I want to understand how the $(selector).live() works. I have a DOM with a lot of elements. So if I write: $('span[attr=value]').live('click').. When jQuery search for this SPAN? jQuery search immediately for all span[attr=value], or every time that I click on any element jQuery check if it span[att=value]?
[jQuery] $.ajaxSuccess.
Sorry about my grammar, English isn't my tang. What is the different betwen: $(document).ajaxSucess(function () {}) $('div').ajaxSucess(function () {}) $.ajaxSetup (success: function () {} ) *When I am execute* $.ajax(url); Also, how I can change the data before it's send to the server by using beforeSubmit? Thank you.
[jQuery] Re: Looping JSON Data
I think that this what R U searching for: var theList={list:[ {id:15,name:Testing,description:test,owner:1,active:1,featured:0,machinename:testing}, {id:16,name:Testing,description:test,owner:1,active:1,featured:0,machinename:testing}, {id:17,name:Testing,description:test,owner:1,active:1,featured:0,machinename:testing} ]}; theList=theList['list']; $.each(theList,function (a,b,c) { alert (b.id + ',' + b.name); }) On Jan 22, 4:46 am, blockedmind blockedm...@gmail.com wrote: I have data recieved by ajax function of jquery like: {list:[ {id:17,name:Testing,description:test,owner:1,active:1,featured:0,machinename:testing}, {id:16,name:Another List,description:Another,owner:1,active:1,featured:0,machinename:another- list}, {id:15,name:Listenin Adı,description:Yeah.,owner:1,active:1,featured:0,machinename:listenin- adi}, ]}; how can i print each list in a loop? i tried many variations, couldn't get the result.
[jQuery] Re: Looping through headers object
Please give as a simple HTML of your table. so we can try help you On Jan 22, 12:21 am, shinobi mattia.bargell...@gmail.com wrote: Hi everybody. I have an html table with a fixed number columns (or headers) and a variable number of columns, that may vary in numbers depending on data in the DB. I want to make sortable one or two columns of the fixed ones, so I would like to know how to loop through the headers object in order to set to sorter:false all the headers that I want to be UN-sortable. In other words, something like: for(i=0;icolNum;i++) { if(i != x) { headers: { i: {sorter: false} } } } where x is the index I want to be sortable. Sorry for my stupid question, but me and javascript aren't good friends :( Thanks in advance for any answer. Mattia (Italy)
[jQuery] Re: $(' Expert jQuery JS synatx ' ).show
Thank you. Very usefull. On Jan 19, 6:41 am, Brandon Aaron brandon.aa...@gmail.com wrote: It works by referencing the method with bracket or array notation. You can reference properties and methods of an object this way. For example: var obj = { test1: 'test_one', test2: 'test_two' }; alert( obj['test1'] ) // alerts test_one alert( obj.test1 ) // also alerts test_one The other code doesn't work because your aren't looking for a property on an object. To make it work you evaluate the expression and then call the method like this. (expr ? 'a' : 'a')(); However, since your function 'a' is global it is a method of the window. You could use bracket notation to reference the method like this. window[ (expr ? 'a' : 'a') ]() -- Brandon Aaron On Sun, Jan 18, 2009 at 9:48 PM, Ami aminad...@gmail.com wrote: Thank you. It's working :) Can you put a function name in an array ?! May you explain me WHY it's working? $('div')[ (true? 'next' : 'before') ]().hide() I tried also this: function a() {alert('Function a')} [expr ? 'a' : 'a']() but it's didn't work. why? On Jan 19, 5:15 am, Brandon Aaron brandon.aa...@gmail.com wrote: I believe you are looking for the following syntax: $(selector)[ (expr ? 'next' : 'before') ]().show(); -- Brandon Aaron On Sun, Jan 18, 2009 at 9:12 PM, Ami aminad...@gmail.com wrote: Sorry about my grammar, English isn't my lang. I am trying to write code like that: var expr=true,selector='div'; $(selector) (expr ? .next() : .before() ). show(); But it's not JS syntax. So how can I do it? I know,that I can do it like that: if (expr) $(selector)..before(),show() else $(selector).next().show() But I am trying to find a solution, that return a jQuery object. Thank you.
[jQuery] $(selector).add($(.next))
Hello, Sorry about my grammar, English isn't my tang. How I add to $ the next elmement. Some think Like I can do: $(selector).add( $(selector).next) But I think that there is a better solution. Thank you.
[jQuery] Re: $(selector).add($(.next))
Thank you. This is exactly what I search. 10 Points :) On Jan 19, 4:45 am, Ricardo Tomasi ricardob...@gmail.com wrote: The only alternative is $(selector).next().andSelf() On Jan 19, 12:08 am, Ami aminad...@gmail.com wrote: Hello, Sorry about my grammar, English isn't my tang. How I add to $ the next elmement. Some think Like I can do: $(selector).add( $(selector).next) But I think that there is a better solution. Thank you.
[jQuery] Re: newby... cannot get $(div).length; to work
You can short it to: $(function() { var divcount = $(div).length; alert(start= + divcount); }); On Jan 19, 4:55 am, Karl Rudd karl.r...@gmail.com wrote: The code is being run before the DIVs actually exist. You need to wrap the code in a ready event handler, like so: $(document).ready( function() { var divcount = $(div).length; alert(start= + divcount); }); Now the code will be run when the document (the HTML not images, etc) has finished loading and is ready. More info about the ready function/event here: http://docs.jquery.com/Events/ready#fn Karl Rudd On Mon, Jan 19, 2009 at 12:45 PM, bartee bar...@gmail.com wrote: I have this test code. My alert dialog always show zero as the div count: Help !!! !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en-AU head titleJquery Test/title script type=text/javascript src=jquery-1.3.js/script script type=text/javascript var divcount = $(div).length; alert(start= + divcount); /script /head body div id=content div id=div2asdf/div div id=div2asdf/div /div /body /html
[jQuery] $(' Expert jQuery JS synatx ' ).show
Sorry about my grammar, English isn't my lang. I am trying to write code like that: var expr=true,selector='div'; $(selector) (expr ? .next() : .before() ). show(); But it's not JS syntax. So how can I do it? I know,that I can do it like that: if (expr) $(selector)..before(),show() else $(selector).next().show() But I am trying to find a solution, that return a jQuery object. Thank you.
[jQuery] Re: $(' Expert jQuery JS synatx ' ).show
Thank you. It's working :) Can you put a function name in an array ?! May you explain me WHY it's working? $('div')[ (true? 'next' : 'before') ]().hide() I tried also this: function a() {alert('Function a')} [expr ? 'a' : 'a']() but it's didn't work. why? On Jan 19, 5:15 am, Brandon Aaron brandon.aa...@gmail.com wrote: I believe you are looking for the following syntax: $(selector)[ (expr ? 'next' : 'before') ]().show(); -- Brandon Aaron On Sun, Jan 18, 2009 at 9:12 PM, Ami aminad...@gmail.com wrote: Sorry about my grammar, English isn't my lang. I am trying to write code like that: var expr=true,selector='div'; $(selector) (expr ? .next() : .before() ). show(); But it's not JS syntax. So how can I do it? I know,that I can do it like that: if (expr) $(selector)..before(),show() else $(selector).next().show() But I am trying to find a solution, that return a jQuery object. Thank you.
[jQuery] Re: Standards box model
Thank you. I mean I afraid css bugs I am devloping in 5 cumputer language, buy I never understand what it's mean W3C Box render model (or somethink like that( Thank you again. On 15 ינואר, 07:19, James Van Dyke jame...@gmail.com wrote: I've always used transitional and had no problems, even with 1.3. Transitional is still a standard, but let's some things slide. However, if you're so concerned with bugs, you may want to wait until 1.3.1 or later. 1.3 is bound to have some lurking issues. On Jan 15, 12:15 am, Karl Rudd karl.r...@gmail.com wrote: Try it and see what Internet Explorer 6 does. Karl Rudd On Thu, Jan 15, 2009 at 3:53 PM, Ami aminad...@gmail.com wrote: So you for you fast answer. 5 point (: Do I must to change all my pages from Transitional to strict? Or can I leave it as Transitional (I afraid from CSS bugs, so i don't want to cahnge) On 15 ינואר, 06:48, Karl Rudd karl.r...@gmail.com wrote: That will work, but you do not need to change to using XHTML. You could use HTML Strict: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/TR/html4/strict.dtd; More information here: http://en.wikipedia.org/wiki/Quirksmode Karl Rudd On Thu, Jan 15, 2009 at 3:08 PM, Ami aminad...@gmail.com wrote: Hello, Sorry about my grammar, English isn't my tang. I read in the Jquery 1.3:release notes, that I must use W3c standards mode. I tried to understand what it's mean. Now my HTML start like that: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//ENhtml dir=rtl DO I need to replace it to this: (Like in Jquery website) !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; Thank you.
[jQuery] The new core LIVE.
The new core LIVE. Hello. Can I use a namespace with live? $.live('click.fuc1',function1 }; $.live('click.fun2'); $.die('click.func1');
[jQuery] Standards box model
Hello, Sorry about my grammar, English isn't my tang. I read in the Jquery 1.3:release notes, that I must use W3c standards mode. I tried to understand what it's mean. Now my HTML start like that: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//ENhtml dir=rtl DO I need to replace it to this: (Like in Jquery website) !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; Thank you.
[jQuery] Re: The new core LIVE.
Thank you. Do you know also about the standards model? that I asked before? Link to the question: http://groups.google.com/group/jquery-en/browse_thread/thread/6545a6ced519de33# On 15 ינואר, 06:36, Karl Rudd karl.r...@gmail.com wrote: Yes. Karl Rudd On Thu, Jan 15, 2009 at 3:10 PM, Ami aminad...@gmail.com wrote: The new core LIVE. Hello. Can I use a namespace with live? $.live('click.fuc1',function1 }; $.live('click.fun2'); $.die('click.func1');
[jQuery] Re: Standards box model
So you for you fast answer. 5 point (: Do I must to change all my pages from Transitional to strict? Or can I leave it as Transitional (I afraid from CSS bugs, so i don't want to cahnge) On 15 ינואר, 06:48, Karl Rudd karl.r...@gmail.com wrote: That will work, but you do not need to change to using XHTML. You could use HTML Strict: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/TR/html4/strict.dtd; More information here: http://en.wikipedia.org/wiki/Quirksmode Karl Rudd On Thu, Jan 15, 2009 at 3:08 PM, Ami aminad...@gmail.com wrote: Hello, Sorry about my grammar, English isn't my tang. I read in the Jquery 1.3:release notes, that I must use W3c standards mode. I tried to understand what it's mean. Now my HTML start like that: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//ENhtml dir=rtl DO I need to replace it to this: (Like in Jquery website) !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; Thank you.
[jQuery] move object with all events.
Sorry about my grammar, English isn't my tango $(#elment).click ( function () { alert('ok') } ); Now, when I move the element: $(#element).insertAfter( otherElement); The click event is automatically unbind. How Can I fix it?