Re: [jQuery] Re: New Forums

2010-01-22 Thread Shawn
And if you were using a screen reader, and had need to post a question 
to the mailing list?  Then you'd still need to deal with the web 
page/forums.


Your solution is a good step in the right direction, but does not solve 
the problems.


I've looked into integrating a forum and mailing list in the past. 
Unless something has changed in the past couple of years, there is no 
good solution.  What is needed is a way to keep a mailing list and forum 
in sync.  Messages sent to the mailing list are automagically posted in 
the forums, with the conversation threads being maintained.  Messages 
posted to the forums are automagically posted to the mailing list.


The closest I've ever seen for this is the forums where you can elect to 
receive an email if a watched topic is posted to.  Or if someone replies 
to you or a topic that you had previously replied to.  While this is 
somewhat workable, it still looses all the benefits of an email list - 
you still have to go to the web page to view/respond to messages.  And 
visiting the web page is not part of the normal routine for a number 
of people.


Karl said it best - we can't please everyone.  Unless someone were to 
sit down and write a tool to integrate/synch a forum (Zoho in particular 
in this case) and the mailing list (Google Groups in this case).  I 
don't forsee that happening anytime soon.


My thoughts.

Shawn

John Arrowwood wrote:

Silly thought:

What if the forums were 'published' to the mailing list, and the mailing 
list were made read-only?  That is, every time a post is published on 
the forum, it is automatically sent to the mailing list.  Then, in the 
footer of the message is a link to reply to the post, which when clicked 
takes you to the forum in such a way that the user can immediately reply 
to that post. 

The mailing list could be set up so that nobody except the forum 'bot' 
could post to it, which would make spam go away.  People that have 
accessibility issues or just prefer to get their information via their 
email client could continue to read things that way.  And you would have 
all of the benefits of the forum. 

Best of both worlds.  Make everybody happy.  I know it would make me 
happier.


On Fri, Jan 22, 2010 at 1:05 PM, Octavian Rasnita orasn...@gmail.com 
mailto:orasn...@gmail.com wrote:


From: MorningZ morni...@gmail.com mailto:morni...@gmail.com
Besides, as Richard pointed out, the mailing list right here will
still exist, it just won't be moderated/managed by the people it was
before..

That would be good, because at least for a period there would still
be an accessible source of information for JQuery.

Octavian




--
John Arrowwood
John (at) Irie (dash) Inc (dot) com
John (at) Arrowwood Photography (dot) com
John (at) Hanlons Razor (dot) com
--
http://www.irie-inc.com/
http://arrowwood.blogspot.com/


Re: [jQuery] New Forums

2010-01-21 Thread Shawn
My apologies to the list managers.  I did not mean to belittle their 
efforts in any way.  I only meant to state that for me, personally, 
forums are not the preferred tool.


I am involved in a number of organizations where the main mantra is the 
concept of a do-aucracy.  If you think it should be done a particular 
way, do it.  For this list, this means that the list managers have DONE 
it, and so they get to make the rules.  I don't pretend to know all the 
considerations that went into the choices that were made.


But, I find it unacceptable that I have to give my contact information 
to zoho.com so that I can use a forum on jquery.com.  (as suggested by 
Andre in a different posting on this thread).  For some reason it is 
deemed ok for our account info (and everything related to it) to be 
accessible by absolute anyone.  Whether it is a FaceBook account, a 
GMail account, etc.  I have put the brakes on for this trend and refuse 
to give my information away to third party sites that have nothing to do 
with what I'm trying to do.  No offense intended to the zoho gang, as I 
do not know them or their intentions/purposes.  But I'll just say no.


My thoughts.

Shawn

Shawn wrote:
I received this email as well.  I don't know if it is legitimate or not 
tough.  Nor do I care.  Web based forums DO NOT WORK for my needs.  I 
cannot do a quick scan of topics in a forum without first opening a 
browser and going to that forum.  Whereas with an email list, I scan my 
email frequently during the day as part of my usual routine.


So, if the mailing list is to disappear, I for one will not spend t 
much effort trying to replace it with a web forum.  I can always use the 
IRC channel when I need assistance.


To be fair though, I can see why there would be a desire to shift away 
from Google Groups.  I will likely take a look at the forum to see 
what's what, but doubt it fill my needs.


Still, there are other alternatives than a web forum (i.e. mailman).

My thoughts.

Shawn

Matt Quackenbush wrote:

Hello,

I received an email inviting me to join the new jQuery forums.  It 
contained a username and password for me to use.  However, when I try 
to login, I am told that my email address has not been confirmed and 
therefore cannot do so.  A link to a help page is given whereby I can 
allegedly have a confirmation email sent by following a list of 
instructions.  Interestingly enough, the very first step given in the 
instructions is to login.  I thought that perhaps I would be able 
to do so at the link given, but alas an attempt to login there results 
in the exact same message and help link being presented.


Any suggestions on how to actually login/activate would be 
appreciated.  :-)




Re: [jQuery] New Forums

2010-01-16 Thread Shawn
I received this email as well.  I don't know if it is legitimate or not 
tough.  Nor do I care.  Web based forums DO NOT WORK for my needs.  I 
cannot do a quick scan of topics in a forum without first opening a 
browser and going to that forum.  Whereas with an email list, I scan my 
email frequently during the day as part of my usual routine.


So, if the mailing list is to disappear, I for one will not spend t 
much effort trying to replace it with a web forum.  I can always use the 
IRC channel when I need assistance.


To be fair though, I can see why there would be a desire to shift away 
from Google Groups.  I will likely take a look at the forum to see 
what's what, but doubt it fill my needs.


Still, there are other alternatives than a web forum (i.e. mailman).

My thoughts.

Shawn

Matt Quackenbush wrote:

Hello,

I received an email inviting me to join the new jQuery forums.  It 
contained a username and password for me to use.  However, when I try to 
login, I am told that my email address has not been confirmed and 
therefore cannot do so.  A link to a help page is given whereby I can 
allegedly have a confirmation email sent by following a list of 
instructions.  Interestingly enough, the very first step given in the 
instructions is to login.  I thought that perhaps I would be able to 
do so at the link given, but alas an attempt to login there results in 
the exact same message and help link being presented.


Any suggestions on how to actually login/activate would be appreciated.  :-)



Re: [jQuery] Column total

2009-12-28 Thread Shawn

jQuery(function() {
var MarketCapTotal = 0;
// loop through the table
jQuery('#grdWatchlistname tbody tr').each(function() {
// replace the dollar signs and commas
var MarketCap = (jQuery('td:nth-child(4)', jQuery(this)).html
().replace('$', '').replace(/[^a-zA-Z 0-9]+/g, ''));
var td4th = jQuery('td:nth-child(4)', jQuery(this));


if (!isNaN(MarketCap)) {
 MarketCapTotal += parseInt(MarketCap);
}


alert(MarketCapTotal);
});
});


Also, your parseInt() function really should specify the radix you want. 
 You can get some unforseen issues if you don't.  So,


MarketCapTotal += parseInt(MarketCap);

would become

MarketCapTotal += parseInt(MarketCap, 10);


Hope that helps.


Re: [jQuery] Anchor navigation /like facebook

2009-12-25 Thread Shawn
I don't think you quite understand what it is you are wanting.  Or maybe 
I'm just a little t drunk.. :)


navigation like that has nothing to do with Ajax.  Using URLs like that 
to request Ajax based data/content is something else.


If you really truly mean navigation, then may I suggest just making an 
anchor tag with the href attribute set to the desired URL?  As in 
standard HTML sans JavaScript.


If you mean you want to make an Ajax request to get content without 
reloading the page, well, you *could* intercept the click event of the 
anchor tag and ask for the data returned by the URL at the href.


Something like this maybe:

$(a).click( function () {
  $.ajax({
url: $(this).attr(href),
dataType: html,
success: function (response) {
  $(#mydiv).html(response);
}
  });

  return false;
});

The return false; is important.  If you don't stop the normal event 
propagation, your page will continue to navigate as if you had clicked a 
normal anchor tag.


Anyways, I really don't mean to be condescending.  I'm just not quite 
clear what you are asking for, and my impression from your message is 
that you are not either.  Hopefully my feeble attempt points you in the 
right direction... :)


Shawn

malts...@gmail.com wrote:

Hi there,

I am trying to find some plugin, which can make AJAX request's by
parsing ANCHOR value, from URL...

For example I have an ajax gallery and I want to make navigation like
this

www.example.com/gallery.php#photo=1
www.example.com/gallery.php#photo=2
www.example.com/gallery.php#photo=3

Any suggestions ?


[jQuery] Re: js function to jQuery

2009-12-24 Thread Shawn
Does jQuery work when you first load the page, and then it stops
working after any ajax postback within the update panel?  If this is
the case there is a pretty simple fix:

instead of using $(document).ready(function() { ...});
use either:
function pageLoad() {
   //code goes here
}

or

Sys.Application.add_load(function() {
   //code goes here
});

The first can be used if you only need one function call, the latter
is for adding multiple function calls to a page load.  I recommend the
latter, since you never know when you may want to separate some js/
jQuery into different external files.  The problem is that jQuery
binds its events to everything the first time the page loads, and then
the update panel sends the entire section of html code within it to
the server, and then a new set of html code is returned.  This means
that all of the events are no longer bound to the new controls inside
the update panel.  In theory you may alternately be able to use $
(#element).live(click... but I've never tested it.

If you have more questions, email me I don't always have time to check
this list. (shawn.so...@gmail.com)
Thanks,
Shawn

On Dec 23, 3:42 pm, Leonardo Balter leonardo.bal...@gmail.com wrote:
 Maybe the asp.Net ajax is still working and changing elements when the DOM
 is ready in the page.

 I would encourage you to get rid of your asp.net ajax too. It's a nightmare
 of issues.

 2009/12/23 Šime Vidas sime.vi...@gmail.com

  Well, it actually gets even shorter... you can combine the two
  selectors into one

  jQuery(#TreeviewTd, #MenuBarTd).toggle();

  I have no experience with the UpdatePanel, but I encourage you to get
  rid of all other AJAX libraries and stick to jQuery...

  Can you tell me why jQuery(document).ready(function(){...}); doesn't
  work when UpdatePanel is present?

 --
 At,
 Leo Balterhttp://leobalter.net
 Blog técnico:http://blog.leobalter.net


Re: [jQuery] prompt before closing dialog

2009-12-17 Thread Shawn

in your buttons definition:

buttons : {
Close : function () {
if (!formChanged()) {
$(#myDialog).dialog(close);
}
else {
$(#confirm).dialog(open);
}

}
}

$(#confirm).dialog({

buttons: {
Yes : function () {
  $(#confirm).dialog(close);
  $(#myDialog).dialog(close);
},
No : function () { $(#confirm).close(); }

}
});

One approach.  Haven't tested this any though... :)

Shawn

Obi1 wrote:

Hi, i'm having some trouble because i'm using a dialog witch has a
form in it where someone can change info about their hotel. this
dialog also has 2 buttons one to close and the other to save changes.
what i'm trying to accomplish is - when someone made sany change and
tries to close de dialog without saving he will be prompt if he really
wants to leave without saving the changes an the dialog only closes if
person choses 'yes'.

when closing the window clicking the 'close' button i can accomplish
this, but i wanted it also to work when closing dialog using the x
button on the top of the dialog.

is this possible?


Re: [jQuery] Best Practices or unobtrusive Javascript

2009-11-30 Thread Shawn
The blocking is an issue, but only if you end up loading more than XXX 
number of elements at a time.  The specific number is browser dependent. 
 I think I read somewhere that IE8 and FF3.5 will only load 4 items 
concurrently (CSS files, JS libraries, images, etc).


So, the knee-jerk solution is to minimize your libraries, compress them 
where possible, enable caching, etc.  OR, load a single JS library that 
will then add the needed elements after the page loads.


Sure putting JS at the end of a file, or even in the middle of the file 
may help with performance, but I would slap my subordinates upside the 
head (in a friendly manner, of course) for doing that.  It makes 
maintaining pages a pain in the rear, seeing as every other page I've 
worked on in recent years puts JS in the header (either library 
includes, or page specific code), AND is contrary to the coding 
standards for our projects.  Writing code that is generally consistent 
with what others tend to do makes that code much easier to understand 
and maintain.


But I recognize the many ways to do things rule, and don't mean to 
suggest my way is right.  If you have the volume where you *really* 
need to worry about performance, then the rules get bent anyways and 
creative solutions are found.  Such as merging all JS libraries into one 
file, then gzipped


My random thoughts.

Shawn

Rafał Pocztarski wrote:

2009/11/30 breadwild breadw...@gmail.com:

I have seen several examples on jQuery plugin sites that have the
script tag and Javascript within the body and not the head where
I thought it was supposed to go.


It's a matter of performance. Put your CSS as close to the top of the
head as possible, and put your JavaScript as close to the bottom of
the body as possible.

This is because browsers try to load everything in parallel but block
while loading, compiling and executing JavaScript (because it could
potentially alter the following HTML - e.g. using document.write). You
can try to work around this but if you just want to include script
tags in your HTML without any fancy tricks to load scripts using
iframes or xhr evals or injections then move your script tags to the
bottom of your page.

Rafał Pocztarski


Re: [jQuery] Best Practices or unobtrusive Javascript

2009-11-29 Thread Shawn
When doing dynamic sites, you sometimes have no choice but to put the JS 
in the body area.  My rule of thumb is to use libraries wherever 
possible and include those libraries in the head section.  But with 
the understanding that *sometimes* (though rarely these days) I will 
need to put JS into the body.


Take a look at what you are doing with the code that is in the body 
area.  Can that code be wrapped up in a function and called in the 
$(document).ready() function?  If so, then that is probably what you 
should be doing to make your code more self contained.


Building Ajax driven sites sometimes needs the code in the body area 
though.  If you dynamically add a block of elements and need to do 
something to them the moment they are loaded, then this *might* be a 
reasonable time to embed JS code directly.  Though I tend to use 
$.ajax() and so can just call a function after adding the elements. 
Which means I can pre-write that function in a library, with no JS 
needed in the body area.


Clear as mud?  :)

Shawn

breadwild wrote:

I have seen several examples on jQuery plugin sites that have the
script tag and Javascript within the body and not the head where
I thought it was supposed to go.

It would be better for my content manager and the templating system if
the Javascript *were* in the body but I don't want to be guilty of
not having unobtrusive code.

What's the standard/acceptable/best practices method?

head
   script
 javascript here
   /script
/head

VS.

body
   html here
   script
  javascript here
   /script
/body

Thanks in advance!


[jQuery] show/hide ui.tab?

2009-11-09 Thread Shawn
I have a series of tabs using UI.  I need to hide some tabs depending on 
the selection in the first tab.  Doing $(#tab3).hide(); doesn't work.


This is what I have thus far:

$(#div.jobtype input[name='jobtype']).click( function () {
$(#tabLocations).hide();
$(#tabSegments).hide();
$(#tabWellholes).hide();
switch($(this).val()) {
case other: $(#tabLocations).show(); break;
case pipeline: $(#tabSegments).show(); break;
case wellsite: $(#tabWellholes).show(); break;
}
});

I did try to add the class ui-tabs-hide to the tab, but that didn't 
work either.  I also did a Google search


I don't want to add/remove tabs - that is not quite what I'm after.  I 
just need to hide/show the tabs.


Any thoughts/suggestions?

Shawn


Re: [jQuery] Re: show/hide ui.tab?

2009-11-09 Thread Shawn
Thanks.  Your message got me looking in the right direction.  Turns out 
my selector was wrong.  Needed #jobtype, not div.jobtype.  Once I 
changed that everything worked as expected.


Shawn

MorningZ wrote:

Show/Hide works perfectly fine in this quick example

http://jsbin.com/oyagi/edit

recall that the tabs are actually li items that reference the
tabs, which are div's  to hide the tab itself, you need to hide
the li

On Nov 9, 10:23 am, Shawn sgro...@open2space.com wrote:

I have a series of tabs using UI.  I need to hide some tabs depending on
the selection in the first tab.  Doing $(#tab3).hide(); doesn't work.

This is what I have thus far:

 $(#div.jobtype input[name='jobtype']).click( function () {
 $(#tabLocations).hide();
 $(#tabSegments).hide();
 $(#tabWellholes).hide();
 switch($(this).val()) {
 case other: $(#tabLocations).show(); break;
 case pipeline: $(#tabSegments).show(); break;
 case wellsite: $(#tabWellholes).show(); break;
 }
 });

I did try to add the class ui-tabs-hide to the tab, but that didn't
work either.  I also did a Google search

I don't want to add/remove tabs - that is not quite what I'm after.  I
just need to hide/show the tabs.

Any thoughts/suggestions?

Shawn


[jQuery] Re: draggable containment

2009-10-28 Thread Shawn


It's been a while since I've worked with drag/drop, so take this with a 
degree of skepticism


But, I believe [x1,y1,x2,y2] refer to the x/y coordinates of the 
rectangle you'd like dragging contained to.  I think you can specify a 
selector though to say contain the dragging to this object.  in which 
case you can point at a div that holds the item being dragged.


Don't know how helpful that is, but hope it is a start...

Shawn

Mike C wrote:

I've spent a good few hours trying to figure this out and I'm stumped.
I'm trying to get a huge div that's bigger than the entire window to
have a scroll feature. I just want to implement draggable and have
it so that you can't see beyond the div. The containment option is
what I need, but the documentation is very unclear about this
property. I'm using an array for containment like the documentation
says, but I have no idea what it means. What does [x1,y1,x2,y2] mean?


[jQuery] SPAM Messages in the list

2009-10-28 Thread Shawn


We should refrain from replying to any of these spam messages that come 
through.  I agree with the sentiments that the spam is NOT welcome here, 
but replying to the thread just adds us as a confirmed email address.


I honestly believe these messages are not being consciously sent by 
anyone, but rather those who do appear to be sending them are likely 
suffering a virus/trojan infection.  Or an automated bot is signed up to 
the list and harvesting emails to send out as.


I think the right approach here is to simply ignore the messages, but 
let the list operators know (via a different thread/message) that these 
need to be addressed.


My thoughts.

Shawn


[jQuery] Re: Your Javascript/Jquery best pratices

2009-10-28 Thread Shawn


When you are working in team environments, a common coding standard is 
very helpful.


What I do is to define the coding standard to be implemented for a 
project, then do periodic code reviews to make sure the standards are 
being applied as well as making sure the code actually works and is sound.


(after thought - make sure your coding standards define how you'll do 
indentation - 4 spaces, 1 tab character, etc)


Coding standards are common for a number of projects.  I thought I had 
seen one for jQuery but am not seeing it right now.  I did find this one 
for the jQuery.UI - http://jqueryui.pbworks.com/Coding-standards. 
Drupal has one at http://drupal.org/node/260140, and Zend Framework's is 
at http://framework.zend.com/manual/en/coding-standard.html (though it 
is down for me at the moment).


Code reviews should be done by someone who has sufficient background 
with the project to understand the big picture.  These reviews should 
not be done to ridicule anyone - there are syntax/logic issues, and then 
there are style issues.  Where you might use a while loop, someone else 
may use a for loop - both are right, as long as the syntax and business 
logic are done right.  Don't harp on anyone for style issues, though 
mentioning it and explaining why you use YOUR style can lead to some 
interesting discussions and growth for everyone.


Regarding best practices, I know there have been a few web postings for 
jQuery/JavaScript best practices.  Here's one: 
http://www.smashingmagazine.com/2008/09/16/jquery-examples-and-best-practices/


Best Practices and Coding Standards should ALL be subject to the job at 
hand.  That is, don't force the developers to jump through meaningless 
hoops just to satisfy and administrative requirement.  Allow 
deviations from the target where it makes sense.  On the other hand, 
getting all developers to use a common standard for a project does help 
quite a bit when collaborating.




Noel GUILBERT wrote:

Hello,

I'm working on a document to standardize javascripts development for
my team.

Actually, each developer writes and organize its code in its own way,
and it's currently a nightmare when an other developer have to work on
the code of another.

I've read a lot of interesting articles about javascript best
practices, but all are about coding. There are not bad, but I'm more
looking about packaging and organization.

As we use jQuery for almost all our project, what is the best way to
use jQuery to build RIA ? Should I build plugins for each feature ?
How do you manage i18n and l10n ?

Thanks!

Noel


[jQuery] Re: ClueTip focus/blur trouble

2009-10-26 Thread Shawn


s close.

Your code works, but due to the unbind of the blur.cluetip event, it 
only works once.  Which makes sense.  So I modified it slightly to the 
following.  This seems to be working so far.


  $this.unbind('blur.cluetip');

$(#cluetip).hover(
function () { $(this).data('hovered', true); },
function () { $(this).removeData('hovered'); }
);

 $this.focus( function () {
$(this).blur(function() {
setTimeout(
function () {
if (!$('#cluetip').data('hovered')) {
$('#cluetip').removeData('hovered');
$(document).trigger('hideCluetip');
}
}, 100
);
   });
 });

The .live() would have been a nice touch here, but it doesn't support 
blur events (yet).


Thanks for the nudge in the right direction.

Shawn

Karl Swedberg wrote:

Hi Shawn,

Here is what I'd probably do:

After you call $this.cluetip( ...), unbind the blur event:

$this.unbind('blur.cluetip');

Then you can handle the closing of the clueTip however you want 
using $(document).trigger('hideCluetip');


Maybe something like this:

$('#cluetip').hover(function() {
  $(this).data('hovered', true);
}, function() {
  $(this).removeData('hovered');
});

$this.blur(function() {
  setTimeout(function() {
if (!$('#cluetip').data('hovered')) {
  $(document).trigger('hideCluetip');
}
  }, 100);
});


You'll have to add the click handler to the list items, too, of course.

Hope that gets you on the right track.


--Karl


Karl Swedberg
www.englishrules.com http://www.englishrules.com
www.learningjquery.com http://www.learningjquery.com




On Oct 22, 2009, at 6:08 PM, Shawn wrote:



Hi Gang.

I'm working with ClueTip and have run into some oddities.

In particular, I want to show ClueTip when a textbox receives focus. 
The source shows me that I can use activation:'focus' for this and 
that will result in the cluetip showing on focus and disappearing on 
blur. Showing the cluetip is working fine, blurring is not.


The code I have is this:

$this.cluetip({
   activation: 'focus',
   local: true,
   showTitle: false,
   sticky: true,
   mouseOutClose: true,
   arrows: true,
   closeText: strongX/strong,
   closePosition: title
   }).focus( function (){ 
$(opts.source).children().removeClass(opts.hover); });


The .focus() method that I have here is simply resetting the classes 
on the items the user may interact with.


I'm using ClueTip to provide a rapid selection tool - similar to a 
drop down list, but without the drop down list UI.  (large number of 
options, needing HTML for formatting, etc.)  The idea is that when the 
cursor arrives at the textbox, the cluetip shows and the user can use 
either the mouse to click an item, or the up/down keys and enter to do 
the same.  Where I am running into problems is with the click 
selection.  If I add a blur handler to the above code:


.blur( function () { $(document).trigger('hideCluetip'); })

then things work well for keyboard selection and blurring, but if I 
click instead, the click event never happens.  Because, clicking on 
the cluetip triggers the blur of the textbox which closes the cluetip 
before the click can be handled.  I suspect this may be partly why the 
onblur isn't working within ClueTip as well - the logistics seem 
rather complex...


So I'm looking for suggestions on how to get this running properly. 
 OR for a plugin that provides similar functionality already.  Thanks 
for any feedback.


Shawn




[jQuery] Re: ClueTip focus/blur trouble

2009-10-25 Thread Shawn


Thanks Karl.  I'll look at this more in a bit.  but from what I can see 
I think you have a solution for me..


Shawn

Karl Swedberg wrote:

Hi Shawn,

Here is what I'd probably do:

After you call $this.cluetip( ...), unbind the blur event:

$this.unbind('blur.cluetip');

Then you can handle the closing of the clueTip however you want 
using $(document).trigger('hideCluetip');


Maybe something like this:

$('#cluetip').hover(function() {
  $(this).data('hovered', true);
}, function() {
  $(this).removeData('hovered');
});

$this.blur(function() {
  setTimeout(function() {
if (!$('#cluetip').data('hovered')) {
  $(document).trigger('hideCluetip');
}
  }, 100);
});


You'll have to add the click handler to the list items, too, of course.

Hope that gets you on the right track.


--Karl


Karl Swedberg
www.englishrules.com http://www.englishrules.com
www.learningjquery.com http://www.learningjquery.com




On Oct 22, 2009, at 6:08 PM, Shawn wrote:



Hi Gang.

I'm working with ClueTip and have run into some oddities.

In particular, I want to show ClueTip when a textbox receives focus. 
The source shows me that I can use activation:'focus' for this and 
that will result in the cluetip showing on focus and disappearing on 
blur. Showing the cluetip is working fine, blurring is not.


The code I have is this:

$this.cluetip({
   activation: 'focus',
   local: true,
   showTitle: false,
   sticky: true,
   mouseOutClose: true,
   arrows: true,
   closeText: strongX/strong,
   closePosition: title
   }).focus( function (){ 
$(opts.source).children().removeClass(opts.hover); });


The .focus() method that I have here is simply resetting the classes 
on the items the user may interact with.


I'm using ClueTip to provide a rapid selection tool - similar to a 
drop down list, but without the drop down list UI.  (large number of 
options, needing HTML for formatting, etc.)  The idea is that when the 
cursor arrives at the textbox, the cluetip shows and the user can use 
either the mouse to click an item, or the up/down keys and enter to do 
the same.  Where I am running into problems is with the click 
selection.  If I add a blur handler to the above code:


.blur( function () { $(document).trigger('hideCluetip'); })

then things work well for keyboard selection and blurring, but if I 
click instead, the click event never happens.  Because, clicking on 
the cluetip triggers the blur of the textbox which closes the cluetip 
before the click can be handled.  I suspect this may be partly why the 
onblur isn't working within ClueTip as well - the logistics seem 
rather complex...


So I'm looking for suggestions on how to get this running properly. 
 OR for a plugin that provides similar functionality already.  Thanks 
for any feedback.


Shawn




[jQuery] Re: JQuery AJAX

2009-10-24 Thread Shawn


Your URL is the culprit.  And the way you are passing data.

Doing http://myserver.com/index.gif?id=1event=e is a GET request - the 
params are on URl directly.  If you want this data to appear in the POST 
then you need to pass them right:


$.ajax({
  async: false,
  type: 'POST',
  url: 'myserver.com/index.gif',
  data: 'id=1event=e',
  cache: false,
  timeout: 0
});

This *should* take care of the OPTIONS thing (I don't know anymore 
details on that at the moment..)


Some observations.  Did you really mean to do a synchronous call? 
Synchronous calls are blocking - they stop further processing until a 
result is returned.  If that result never returns, you've hung your 
code.  This is what the timeout attempts to handle.  There IS a time and 
place for synchronous calls, but with what you've given us so far I 
don't think this is one of them.  To make it asynchronous (which is what 
the first A in Ajax means), you'd change your code like this:


$.ajax({
  type: 'POST',
  url: 'myserver.com/index.gif',
  data: 'id=1event=e',
  cache: false,
});

Next, you are setting cache to false - I'm assuming because you really 
want the server to process each request.  What I've done in the past is 
to just attach a random number to the URL.


url: 'myserver.com/index.gif?r=' + Math.random()

this works well enough for my needs, though I'm not sure if this is a 
best practice.


Next, your url parameter points to 'myserver.com/index.gif'.  $.ajax 
cannot do cross domain requests (unless you use jsonp, which is a little 
beyond this discussion...).  The URL should be a relative path to a file 
from your current page.  Also, why are you requesting index.gif?  Do you 
have serverside configs that redirect index.gif?  Why not just call 
mypage.php instead?  Remember that an Ajax call is a REQUEST of a 
resource, and that resource can return whatever.  I suspect you are 
converting some old school code where the request for a gif file was a 
precursor to modern Ajax, but could be wrong.


Finally, Your request will return a response of some type.  You should 
be handling that response in the success and/or error properties.  Then 
again, they are not required.  But what happens if something unexpected 
happens?  Does your app fail gracefully?


This should get you pointed in the right direction.  I suspect you may 
have problems with your event parameter (it appears it should be an 
object, not the letter 'e'...), but that is relatively minor.


Hope this helps.

Shawn

Ryan White wrote:

Hey All,
So I am having a weird situation when using the $.ajax method.  And have 
a couple questions regarding this.  What I am doing is basically just 
using this AJAX call to send a 'pixel' back to my server so I can 
collect stats on events.  This event fires once every 30 seconds.


$.ajax({
async: false,
type: 'POST',
url: myserver.com/index.gif?id=1event=e 
http://myserver.com/index.gif?id=1event=e

cache: false,
timeout: 0
 });

My requests keep coming in as OPTIONS call, instead of POST.  Every once 
in a while I will get a random rogue GET request that basically mimics 
the previous OPTIONS request.  The OPTIONS come very 30 seconds.  The 
rogue GET comes whenever, only seldomly.


1)  What is OPTIONS and why would it come out as OPTIONS instead of POST?
2)  Why would GET requests come at all?  Why would they come randomly 
(seemingly) without being called?
3)  Is this a proper way of sending a 'pixel' back to my server to track 
stats?  If not, what is a better way?


Very new to AJAX, and definitely don't know all the internals.  Any help 
would be greatly appreciated.


Thanks in advance


[jQuery] Re: JQuery AJAX

2009-10-24 Thread Shawn


btw, if you are trying to track stats, have you looked at Google 
Analytics or Piwik?


http://www.google.com/analytics/
http://piwik.org/

Shawn

Ryan White wrote:

Hey All,
So I am having a weird situation when using the $.ajax method.  And have 
a couple questions regarding this.  What I am doing is basically just 
using this AJAX call to send a 'pixel' back to my server so I can 
collect stats on events.  This event fires once every 30 seconds.


$.ajax({
async: false,
type: 'POST',
url: myserver.com/index.gif?id=1event=e 
http://myserver.com/index.gif?id=1event=e

cache: false,
timeout: 0
 });

My requests keep coming in as OPTIONS call, instead of POST.  Every once 
in a while I will get a random rogue GET request that basically mimics 
the previous OPTIONS request.  The OPTIONS come very 30 seconds.  The 
rogue GET comes whenever, only seldomly.


1)  What is OPTIONS and why would it come out as OPTIONS instead of POST?
2)  Why would GET requests come at all?  Why would they come randomly 
(seemingly) without being called?
3)  Is this a proper way of sending a 'pixel' back to my server to track 
stats?  If not, what is a better way?


Very new to AJAX, and definitely don't know all the internals.  Any help 
would be greatly appreciated.


Thanks in advance


[jQuery] ClueTip focus/blur trouble

2009-10-22 Thread Shawn


Hi Gang.

I'm working with ClueTip and have run into some oddities.

In particular, I want to show ClueTip when a textbox receives focus. 
The source shows me that I can use activation:'focus' for this and that 
will result in the cluetip showing on focus and disappearing on blur. 
Showing the cluetip is working fine, blurring is not.


The code I have is this:

$this.cluetip({
activation: 'focus',
local: true,
showTitle: false,
sticky: true,
mouseOutClose: true,
arrows: true,
closeText: strongX/strong,
closePosition: title
}).focus( function (){ 
$(opts.source).children().removeClass(opts.hover); });


The .focus() method that I have here is simply resetting the classes on 
the items the user may interact with.


I'm using ClueTip to provide a rapid selection tool - similar to a drop 
down list, but without the drop down list UI.  (large number of options, 
needing HTML for formatting, etc.)  The idea is that when the cursor 
arrives at the textbox, the cluetip shows and the user can use either 
the mouse to click an item, or the up/down keys and enter to do the 
same.  Where I am running into problems is with the click selection.  If 
I add a blur handler to the above code:


.blur( function () { $(document).trigger('hideCluetip'); })

then things work well for keyboard selection and blurring, but if I 
click instead, the click event never happens.  Because, clicking on the 
cluetip triggers the blur of the textbox which closes the cluetip before 
the click can be handled.  I suspect this may be partly why the onblur 
isn't working within ClueTip as well - the logistics seem rather complex...


So I'm looking for suggestions on how to get this running properly.  OR 
for a plugin that provides similar functionality already.  Thanks for 
any feedback.


Shawn


[jQuery] superfish navbar - how do I center the whole bar?

2009-10-20 Thread Shawn

I'm using a navbar with superfish. I simply put my menu list inside a
wrapper so the markup looks like this:

div class=navbar-wrapper
ul class=sf-menu sf-navbar
li.../li
li.../li
li.../li
/ul
/div

now I want to make the navbar-wrapper 100% of width and the navbar to
be centered in it, I thought it should be simple just do the following
css trick

div.navbar-wrapper{ width:100%; text-align:center; }

However this didn't work, the supersish menu just didn't get
centered.

How can I fix this? Thanks.


[jQuery] Re: superfish navbar - how do I center the whole bar?

2009-10-20 Thread Shawn


If you have markup as indicated below, then you have invalid markup, 
which will cause problems.


A UL element can't contain a div - it has to contain li's, which in turn 
can contain a div.  I would expect that structure to fail.


Removing the div immediately after the UL, will clean things up.

Now, for centering, you may have to wrap the whole thing in a separate 
div and then use the CSS tricks to center THAT div - auto margins, 
text-align, etc.


er. just read your request a little more.  Try this:

div class=navbar-wrapper
  div class=centerMe
ul class=sf-menu sf-navbar
  li.../li
  li.../li
  li.../li
/ul
  /div
/div

Apply the centering tricks to div.centerMe.

Disclaimer - I just pulled an all nighter, so I need to freely suggest 
that my advice at this point may be questionable... :)


Shawn

rupak mandal wrote:

Put the ul inside a div. I think it will work



On Tue, Oct 20, 2009 at 9:05 AM, Shawn shallway...@gmail.com 
mailto:shallway...@gmail.com wrote:



I'm using a navbar with superfish. I simply put my menu list inside a
wrapper so the markup looks like this:

div class=navbar-wrapper
ul class=sf-menu sf-navbar

div

li.../li
li.../li
li.../li
/ul

/div

/div

now I want to make the navbar-wrapper 100% of width and the navbar to
be centered in it, I thought it should be simple just do the following
css trick

div.navbar-wrapper{ width:100%; text-align:center; }

However this didn't work, the supersish menu just didn't get
centered.

How can I fix this? Thanks.




[jQuery] Re: Json works in firefox but not in ie

2009-10-19 Thread Shawn


Common problem.  It was blogged about in Feb last year 
(http://grover.open2space.com/node/207).  Still, I'm glad you found the 
solution.


Shawn

Patrik wrote:

Problem solved it was an extra , after the last {optionValue: '.
$b .', optionDisplay: '. $b .'} in the php file. firefox must have
ignored it while ie expected more.

On 19 Okt, 16:49, Greg Riley goh...@gmail.com wrote:

You are setting options inside a function and then trying to reference
it outside of that function.

Try putting var options = ''; before that first line.

On Oct 19, 10:22 am, Patrik patrik.spat...@gmail.com wrote:


Hi,
I have this code and it works well in firefox but in IE it dosn't.
How do I make it work in IE?
If I put alert(options) inside the loop I get all the values I want so
this far it's working but outside the loop if i call alert(options)
nothing happens. why?
$(select#kod).change(function(){
   $.getJSON(artnr-ajax.php,{value: $(this).val(), where: 'kod'},
function(j){
  var options = '';
  for (var i = 0; i  j.length; i++) {
 options += 'option value=' + j[i].optionValue + '' + j
[i].optionDisplay + '/option';
  }
  $(select#beteckning).html(options);
})


[jQuery] Re: Ajax populating select box based on radio selected

2009-10-13 Thread Shawn


in short, no.  Not that I know of.  I mean no plugin per se.  The 
code/script is simple enough though...


$(#myradio).click( function () {
  $.ajax({
url: somepage.php,
data: id=somevalue,
dataType: json,
success: function (results) {
  var opts = ;
  for (x=0; x  results.length; x++) {
opts += option + results[x] + /option;
  }
  $(#mySelect).empty().append(opts);
}
  });
});

that's kinda rough, but should get the point across.  The results you 
get back from the ajax call can be whatever you want - a new HTML 
definition of the select element, a json array of objects, a simple 
array of text values (as hinted at in the sample code), or even xml. 
Whatever you pick for the results format dictates what you have to do 
with the results to get it into your select list.


The flexibility and diversity of the approaches here are probably why 
there is no (known) plugin.  Yet the code is simple enough to slap 
together in less than 5 minutes.


HTH.

Shawn

lionel28 wrote:


Hello,

Is there a script that allows to get values to populate a select box via
ajax when a radio button is clicked?

Thank you.


[jQuery] Re: Ajax populating select box based on radio selected

2009-10-13 Thread Shawn


that is a different issue than the ajax thing.  but, it's also a common 
thing.. :)


$(input[name='myradio']:checked).val()

That should do it.  Get the value of the checked radio option...  I 
changed it to not use an ID, cuz chances are you are you are using a 
name and not an ID...


Failing that, you could extend things a little and loop over each of the 
radios:


$(input[name='myradio']).each( function () {
  if ($(this).attr(checked) == true) {
radioValue = $(this).val();
//do something with the value
// ...

//no need to loop to the next item,
//so return false to end the .each()
return false;
  }
});

The first approach is preferable, I'd think - less looping involved. 
But this second approach shows an expanded way to do the same thing, 
which is sometimes needed when doing something a little more non-simple.


HTH

Shawn

lionel28 wrote:


hummm,

not that simple. It's multiple radios with multiple values
so how to get id and value of selected one?




lionel28 wrote:

Thanks for replying.
I am going to try your code.


Shawn Grover wrote:


in short, no.  Not that I know of.  I mean no plugin per se.  The 
code/script is simple enough though...


$(#myradio).click( function () {
   $.ajax({
 url: somepage.php,
 data: id=somevalue,
 dataType: json,
 success: function (results) {
   var opts = ;
   for (x=0; x  results.length; x++) {
 opts += option + results[x] + /option;
   }
   $(#mySelect).empty().append(opts);
 }
   });
});

that's kinda rough, but should get the point across.  The results you 
get back from the ajax call can be whatever you want - a new HTML 
definition of the select element, a json array of objects, a simple 
array of text values (as hinted at in the sample code), or even xml. 
Whatever you pick for the results format dictates what you have to do 
with the results to get it into your select list.


The flexibility and diversity of the approaches here are probably why 
there is no (known) plugin.  Yet the code is simple enough to slap 
together in less than 5 minutes.


HTH.

Shawn

lionel28 wrote:

Hello,

Is there a script that allows to get values to populate a select box via
ajax when a radio button is clicked?

Thank you.








[jQuery] Re: Treeview - Custom hyperlink click event

2009-10-11 Thread Shawn


are you returning false from your event handler?  That *should* stop all 
other event processing.


You could also try to capture the event object (i.e. 
.click(function(theEvent) { });  ) and then make use of the 
.stopPropagation() method.


Neither trick will do you any good if the treeview's event handlers are 
fired before your event though.


Some random thoughts.. Haven't tried any of this.

Shawn

philsturgeon wrote:

I am trying to remove the default behaviour from the A within the
Treeview structure. I want the +/- icons to continue to toggle but
when a user clicks on the A I want to fire my own event.

This event is currently firing fine, but it also fires the toggle
behaviour meaning the tree still expands or collapses. Wrong!

http://pastie.org/650742

Does anybody know how I can solve this? I tried unbind() and die() on
all a's within the tree but that did nothing. Im really stuck on this
one! .


[jQuery] Problems with elements shifting when scripts are activated in IE8 (jscrollpane script)

2009-10-07 Thread Shawn - Eclectic Whimsy

Hi there, I'm fumbling through here so I apologize in advance for
being such a newby to javascripts and jquery. I spent the entire day
yesterday getting jscrollpane to work on a site I've been working on
and was SO excited to see that it was working beautifully in firefox
this morning after some editing of the code and figuring a few things
out. Unfortunately in IE8 something is causing all of my elements to
shift up way above where they should be, including the sidebar
navigation which should have nothing to do with the jscrollpane
script. The only reason I'm thinking it must have something to do with
the script is that when I open in IE it looks fine (although with the
ugly browser scrollbar) until I activate the script in the script/
activex pop up bar along the top of the screen.
As soon as I click to allow the scripts it shifts all of my content
up.

I've uploaded the site to a temporary area of my own site here:

http://www.auntiepea.com/ew/OldFarm/index.html

The same thing happens on one of the other pages that I thought I had
finished here:

http://www.auntiepea.com/ew/OldFarm/services.html


I would SO love to be able to use this script but I think I've hit my
level of javascript abilities here. Any advice would be GREATLY
appreciated.

I posted this to the jscrollpane also but thought I'd post here as
well since it was mentioned on the jscrollpane page that I may get a
faster response on this discussion board and I'd really love to figure
this out today if possible.

Thanks so much in advance!


[jQuery] Re: Problems with elements shifting when scripts are activated in IE8 (jscrollpane script)

2009-10-07 Thread Shawn - Eclectic Whimsy

Thanks so much BaBna. I think you're right about it not having
anything to do with the javascript itself. I probably should be asking
this in a general web design forum except for that I've never had
issues with this shifting (at least not nearly to this degree) on
sites that haven't included the javascript area so I'm hoping maybe
someone can take a peek at the code and see if something obvious jumps
out that I should be doing differently. Could it be the placement of
the scripts? Or is there an issue with using an editable region of a
template to call on the script. I'm hoping not the latter because I'll
have a number of pages within the site that I'd like to use the
scrolling script and would rather not have to rebuild the navigation
area for each page.

After rebuilding the entire template and index to try and clean up the
issues, hoping this time things would line up properly in IE the way
they do in firefox now the scrollpane/main content area has shifted
below the area where it should be.  I was hoping maybe including a
header and footer (although basically empty boxes) that I could
contain that main content area in the correct area. No such luck. :(

I would be eternally grateful for further direction on which area it
is that's causing my IE issues.

On Oct 7, 11:04 am, BaBna thomas.na...@gmail.com wrote:
 Hey there,
 I don't think it has anything to do with the javascript here, it's
 your CSS or HTML structure:
 you've got DIV and P on the same level, and you must miss some float
 or overflow property on some of your DIV.
 Basically, your div with the jScrollPaneContainer class is not
 pushed below by the blocks before it.


[jQuery] Re: Problems with elements shifting when scripts are activated in IE8 (jscrollpane script)

2009-10-07 Thread Shawn - Eclectic Whimsy

I forgot to include the link again, just so it's handy if anyone can
take a look: http://www.auntiepea.com/ew/OldFarm/index.html


[jQuery] Re: Problems with elements shifting when scripts are activated in IE8 (jscrollpane script)

2009-10-07 Thread Shawn - Eclectic Whimsy

Update. I figured out which area was causing the issues. Zeroed out
the margins on the main content area and used padding to place the
content where I wanted it. Worked like a charm.

Thanks again BaBna for headin' me in the right direction on this.

On Oct 7, 11:04 am, BaBna thomas.na...@gmail.com wrote:
 Hey there,
 I don't think it has anything to do with the javascript here, it's
 your CSS or HTML structure:
 you've got DIV and P on the same level, and you must miss some float
 or overflow property on some of your DIV.
 Basically, your div with the jScrollPaneContainer class is not
 pushed below by the blocks before it.


[jQuery] Re: keepp getting NaN vlue

2009-09-28 Thread Shawn


further to that, you can do

var distance = parseInt($(#distance.val(), 10);

Using the radix (the second parameter - 10 in this case), forces the 
specific conversion you'd like.  When dealing with dates at least, 
leaving out the radix can sometimes result in abnormal behavior that is 
VERY hard to troubleshoot.


Oh, if the number is not an integer, use parseFloat() instead of 
parseInt().  (er, sry if this is TOOO basic.. :) )


Shawn

Giovanni Battista Lenoci wrote:


runrunforest ha scritto:

Hi, I'm making a calculator for freight customer

It seems I'm on the right path. But there is two bugs i need help.

The TOTAL TO PAY value always seem to appear as NaN at first instead
of default 3.

And the function of TOTAL TO PAY only work after checkbox is checkd, I
need it work regarding to changing of input value not just checkbox.
  


I didn't chek all of your code, but remember:

$('#distance').val();

returns a string, not an int.

Bye



[jQuery] Re: ultimate submenu(please help me)

2009-09-24 Thread Shawn


Superfish doesn't do the trick? 
http://users.tpg.com.au/j_birch/plugins/superfish/#examples


They show the JS code to make that work.  View Source on the page and 
you find the menus are just lists (ul's).  So if you need more complex, 
just build the nested lists as needed.  If you need Ajaxified, just 
update the lists as needed.  (though you may need to re-apply the 
superfish command then).


Shawn

hamed7 wrote:

hi
i want create ultimate submenu and support multilevel for example like
this:
--
1:
1-1

2:
2-1
2-2-1
2-3-1-1
2-3-2-1
2-4-1-1-1
2-5-1-1

3:
3-1-1-1

4
---
i need some idea or some sourcecode(ajax sourcecode is better than
none ajax)
*please help me this is important for me very much.


[jQuery] Re: Page goes up when I click the link

2009-09-09 Thread Shawn


Not familiar with the BlockUI plugin.  But, do you have a .click() event 
somewhere related to that link?  If so, return false from the event handler.


Setting href=# means a named anchor.  # by itself is top of the 
page.  So, if the anchor tag's normal click handler is executed, you'll 
be returning to the top of the page.  You need to stop the normal 
handler - which is usually done in jQuery by returning false from and 
event handler function.


HTH

Shawn

merihsaka...@yahoo.com wrote:

Hi all,
I am using jQuery BlockUI Plugin (v2). It works success but I have a
small problem, when I click the link, it is bloclking the page but the
main page goes up.

Also same problem for link which is oppening new tab or new windows.
main pages goes up when I click the link.

any advice

Thanks,


[jQuery] Re: Page goes up when I click the link

2009-09-09 Thread Shawn


judging from that snippet, I don't think jQuery or BlockUI is the problem.

Using onClick is old school and should be avoided these days.  It mixes 
functionality with data/presentation when these things should be kept 
separate.  (just like CSS should be kept in it's own file rather than 
inline, JS should be the same...)  The phrase that describes this is 
unobtrusive javascript.


You can try changing the onclick= in both samples to
onClick=(); return false;  - where the () is the existing 
functions (add a return false; at the end).  But I think you probably 
need to look into native JS methods to stop propagation.


Is this inherited code?  Or generated by Dreamweaver?  Eitherway, the 
code looks reminiscent of DW to me.  Both those functions should 
probably make better use of jQuery, but methinks that is a separate 
issue.. :)


HTH

Shawn

nasionalem wrote:

Hi thaks for your reply,

How can I stop normal handler.

my link is like that..

script type=text/javascript
function information(){
jQuery.blockUI({ message: jQuery('#111'), css:
{border: '0px solid #a00', textAlign:'center'} });
};
/script

a href=# onclick=information()info/a

The other link has same problem..

a href=# onClick=MM_openBrWindow
('information.do','','status=yes,scrollbars=yes,resizable=yes,width=400,height=350')Info/
a


On Sep 9, 10:39 am, Shawn sgro...@open2space.com wrote:

Not familiar with the BlockUI plugin.  But, do you have a .click() event
somewhere related to that link?  If so, return false from the event handler.

Setting href=# means a named anchor.  # by itself is top of the
page.  So, if the anchor tag's normal click handler is executed, you'll
be returning to the top of the page.  You need to stop the normal
handler - which is usually done in jQuery by returning false from and
event handler function.

HTH

Shawn



merihsaka...@yahoo.com wrote:

Hi all,
I am using jQuery BlockUI Plugin (v2). It works success but I have a
small problem, when I click the link, it is bloclking the page but the
main page goes up.
Also same problem for link which is oppening new tab or new windows.
main pages goes up when I click the link.
any advice
Thanks,- Hide quoted text -

- Show quoted text -


[jQuery] Re: how can I treat a string as JSON?

2009-09-08 Thread Shawn


instead of using $.getJSON(), maybe use $.ajax() directly?

Something like this:

$.ajax({
  url: 'some/url.php',
  data: 'id=' + $(#id).val(),
  type: 'post',
  dataType: 'json',
  success: function (results) {
console.log(results);
  }
});

The magic here is the dataType option.  It tells $.ajax that it is 
expecting a JSON object and does what it needs to to convert the results 
to an object (if possible).  The results variable is just the object 
passed to the success callback function - name it whatever makes sense 
to you.  But once inside the success function, you *should* be dealing 
with an object, not a string.


I find that in most cases $.ajax() is much clearer and causes less grief 
for me than using the other Ajax type functions (.load(), .getScript(), 
.getJSON(), .get(), .post(), etc.).  I could be wrong, but I think these 
are all just wrappers to $.ajax() anyways.  I do use some of these 
convenience functions, but the moment I need to start worrying about 
callbacks, or what data I'm passing, $.ajax() makes life clear and 
simple for me.


HTH.

Shawn

Alex Weber wrote:

I use $.getJSON for all my ajax stuff and it works beautifully but
there is one particular situation where I use an iframe hack to do an
ajax file upload and even though the returned value is a json object
(created with PHP), jQuery treats it like a string.

I'm using json2.js right now and it does the trick but I don't like
including that much extra code because of one rare situation.

So my question is, be it with $.getJSON or by specifying 'json' as the
expected return type of an ajax request, jQuery *seems* to be able to
convert into json.

The string returned is already a json object, I just need jQuery to be
able to treat it like one.  I've tried wrapping it in a jQuery object
but no use.  (and I really don't want to go down the eval() path)...

Any suggestions?

Thanks!!


[jQuery] Re: Anything wrong with this ajax syntax?

2009-09-07 Thread Shawn


Your URL indicates you are returning json (returnType=json).  But, you 
do not specify a dataType for the $.ajax() call.  So, your response 
variable is plain text, I think.


Two things to try:

1) put  dataType: json,  before the success line.
2) first line of the success function, do something like 
console.log(response); and see what you get.  If it is plain text, you 
will see the text.  if it is JSON, you should get an object or array 
shown (firebug will color code these for you.  um.. you ARE using 
Firebug aren't you? lol )


HTH

Shawn

Rick Faircloth wrote:

Is there something missing that would keep it from functioning?

 


This ajax function only serves to cause a ColdFusion function to create

HTML that is then loaded as specified in the code.

 


However, the success part of the function is not executed.

No errors or anything…it’s as if the ajax function just doesn’t work at all.

 

If I put “alert(‘Inside function’); “ just after the first line of the 
function and


before the $.ajax line below, the alert fires properly.  If I add an alert

in the response section in the first line of the “if” section, the alert 
doesn’t fire.


Again, no errors from my server-side code or for the jQuery.

 


So, the question is whether or not the $.ajax function will work as coded,

or are other parameters needed?  (I tried ‘post’ for type, as well…)

 


Here’s the $.ajax function:

 


script type=”text/javascript”

 


 function buildLoginDialog() {

 


 $.ajax = ({ cache: false,

 type:  'get',

 url: 
  'components/login.cfc?method=mBuildLoginDialogreturnType=json',


 success:   function(response) {

   

 if   (   (response.STATUS = 'Login 
Dialog Build Successful')   )


  {   var loginDialogHTML = 
'components/loginDialogHTML.cfm?' + new Date().getTime();


   
   $('.loginDialog').load(loginDialogHTML);



  login();  }


   



 else {   alert('Login Dialog Build 
Failed');   }


  


}

 });

  }

 


/script

 


Thoughts or suggestions, anyone?

 


Thanks,

 


Rick

 


/---/

/Those who hammer their guns into plows will plow for those who do 
not.  - Thomas Jefferson/


 



[jQuery] Re: How to unsubscribe?

2009-09-06 Thread Shawn


go to http://groups.google.com/group/jquery-en.  Sign in with the 
account you used to sign up (probably your email address you receive 
list mail on).  Then on the right hand bar is an Edit my membership 
link.  On the resulting page, set the radio button to no email, hit 
save, and you should be done.


HTH.

Shawn

Asif R Naqvi wrote:

Could any please advise how to to unsubscribe from this group?


[jQuery] Re: How to unsubscribe?

2009-09-06 Thread Shawn


it shows up after you sign in.  (sign in link is in the top right corner)



Asif R Naqvi wrote:
Hi, thanks for the advise but there's no such link appearing at the 
right! Am I missing something here or it just not appearing there! Using 
Chrome.


Asif


*From:* Shawn sgro...@open2space.com
*To:* jquery-en@googlegroups.com
*Sent:* Sunday, 6 September, 2009 15:17:09
*Subject:* [jQuery] Re: How to unsubscribe?


go to http://groups.google.com/group/jquery-en.  Sign in with the 
account you used to sign up (probably your email address you receive 
list mail on).  Then on the right hand bar is an Edit my membership 
link.  On the resulting page, set the radio button to no email, hit 
save, and you should be done.


HTH.

Shawn

Asif R Naqvi wrote:
  Could any please advise how to to unsubscribe from this group?


[jQuery] Re: Sloppy Documentation of Ajax Methods

2009-08-09 Thread Shawn


ALL the functions (load, get, post, etc) are wrappers for the $.ajax() 
function.  I only use $.ajax() now and tweak it to meet my needs... 
Makes for less confusion.


Ajax by default will only load files that are in the same domain as the 
calling page.  This is a browser security feature.  (Use $.ajax() and 
jsonp to work around that.)  So the getScript() function will follow 
this limitation as well if it is calling the new script via Ajax.


My thoughts.

Shawn

rickoshay wrote:

Here are the descriptions for the Ajax methods:

load -- Loads HTML from a remote file ...
ajax -- Load a remote page ...
get -- Load a remote page...
getScript -- Load and execute a local javascript file...
post -- Load a remote page...

So, if we want arbitrary HTML we have to use load, but if we want a
whole page (where is that defined?)  we have to use ajax, get or
post?

The execute script function (called getScript for some reason) only
works with local files? I believe it will work with any URI (local
or remote) returning JavaScript (assuming same origin policy of
course), and whether it came from a file isn't known to the caller.

These functions should describe the type of HTTP request they make,
and skip references to pages and files.




[jQuery] Re: Selector help

2009-07-19 Thread Shawn


that would still fail - unless he has a tag named this  just like 
doing $(a) finds anchor tags.  If however he is using this in terms 
of an event handler (where this is a reference to the DOM object that 
threw the event, then he would need to remove the quotes:


$(this).siblings('h1').height();

In this case $(this) says to put the jquery wrapper object around the 
DOM element represented by this in the current context.


The difference is very minor, I know, but I did not see in his 
description just what this represented...


Shawn

Charlie wrote:
you can't use this in same manner as tagnames, ID's or class as a 
selector in combination with other selectors the way you are attempting.


try:

h1Height =  $('this').siblings('h1').height();




Warfang wrote:

I'm pretty new to Javascript/ jQuery, so this is really bugging me.

I'm trying to get the height of an h1 that is a sibling to this. The
value for the variable h1Height, however, returned as null in the
console in Firebug. Perplexed, I tried console.logging ('this'+'+h1')
to see what it was interpreted as. It brought back this+h1, which
should select an h1 adjacent to this (which is a div).

Javascript
h1Height =  $('this'+'h1').height();

What went wrong?

  




[jQuery] Re: simple JSON parse problem!!!

2009-07-01 Thread Shawn


As mentioned in another reply, theObject is an object.

So, building a string with

( + theObject + );

will not give you what you'd expect.  If that were to work at all you'd 
likely end up with a string of ([Object]) - not what you want.


If you really must do the eval(), then it should be something like

var json = eval( '{ key : value }' );

But, eval() is evil and should be avoided wherever possible.  Mostly 
because it is mis-used, introduces various issues, and is known to be an 
expensive call in terms of processing speeds.  It *is* the right tool in 
some cases though...


In your code, I'd recommend doing as MorningZ mentioned:

var theObject = { key: value};
alert(theObject.key);

HTH

Shawn

theozmanbo wrote:


Why won't this work??? Nothing pops up for the alert.

script type=text/javascript

var theObject = {key: value};
var JSON = eval ((+theObject+));
alert(JSON.key);

/script


[jQuery] Re: getting the value of list box in jquery

2009-07-01 Thread Shawn


First, this is a mailing list.  Not an IRC channel or Instant Messenger. 
 This means replies can take hours or even days sometimes.  Patience is 
the keyword here.  If you need help with an issue that urgently, try the 
##Javascript channel on IRC.  The message I am replying to is 
timestamped 12:56am.  If I kept normal hours, I would not have even seen 
your message for another few hours yet.


As for your question.  the .val() will return the current value of the 
form element.  A multi-select list *may* return all the selected 
elements, but that is not my experience in the few times I've tried this.


In the case of a multi-select list, I find it better to fall back to 
some old school techniques and remember that the selected property 
will be set to true on each of the selected options.  So, I do something 
like this:


var selectedArray = [];
$(#right option).attr(selected, true).each( function () {
  selectedArray.push(this.val());
});

alert(selectedArray); - should result in the comma delimited string you 
are looking for.  IF and ONLY if there are selected items.


The gurus here will tell you my approach is probably overly long, but 
it's worked for me.  Your mileage may vary.  Tweak it as needed.


Shawn

naz wrote:

i m w8ing for your reply

On Jul 1, 9:32 am, MorningZ morni...@gmail.com wrote:

Got some HTML to show of the select box?

if you have

select id=right mulitple=multiple
 option value=1One/option
 option value=2 selected=selectedTwo/option
 option value=3 selected=selectedThree/option
/select

then

$(#right).val()  will be an array that is 2,3

if it's not like that, then (1) your selector doesn't work, (2)
there's nothing actually selected

On Jul 1, 12:18 am, naz s.na...@gmail.com wrote:




yes i have multiple value in that list box and i want to have all
values in the form of comma seperated list.
you are telling me to write some thing like this?var cources_matrix=$
('#right').options.val();
right is id of my listbox.i dont know how to do it and bcz of this my
work is stoppped. plz tel me what to do
On Jun 30, 3:12 pm, Charlie charlie...@gmail.com wrote:

do the options in select each have a value assigned? are you working with a 
number value and need to parsInt()? Need more info to help
can you put an example of this not working in jsbin? or post link
naz wrote:i have a list box and i want to get its values in jquery please tel 
me how can i do that i m writing $('#right').val(); but this is giving me null 
plpease tell me how can i do that i need help as soon as possible thx to all 
persons which reply to my questions- Hide quoted text -

- Show quoted text -


[jQuery] Re: simple JSON parse problem!!!

2009-07-01 Thread Shawn


theozmanbo wrote:

uploadPicture{errors:[This file was already uploaded]}



That is not valid JSON.

If you were returning

{errors:[This file was already uploaded]}

You would have more luck.  In fact I'm willing to bet you'd be able to 
do something like  alert(data.errors[0]) - because the data variable 
would likely already be translated to a JS object, rather than a string. 
 But, I don't know the details of the ajax upload plugin you are 
using either, so I could be wrong.


As mentioned in another reply.  You should probably go study up on JSON 
more.  It seems your core issues are within your current understanding 
of JSON.  You're not far off, but not quite there. :)


Shawn


[jQuery] Re: Horizontally scroll a table

2009-06-18 Thread Shawn


Not sure if this meets your needs or not:

https://www.open2space.com/projects/fixedtable

It's a little dated, but does work in some (not all) cases...

Shawn


michael wrote:

Hello all,

Is there a plugin somewhere that will allow a table to horizontally
scroll within a set width?  I could swear I saw this once but can't
find it now.  Basically I'm looking for an Excel-like setup.  I have a
div that's 990px wide and need to constrain a table within that to
keep from going off and having the whole thing scroll horizontally.
Bonus points for freezing one or more columns on the left.  Has anyone
seen this or could anyone provide me with some pointers on getting it
done myself?


[jQuery] Re: Safari reader Article Length with jQuery?

2009-05-25 Thread Shawn


Google is your friend:

http://www.google.com/search?ie=UTF-8oe=UTF-8sourceid=navclientgfns=1q=jquery+resizable+div

In particular the UI resizable component:
http://jqueryui.com/demos/resizable/

Now with that out of the way, I have no clue how Safari reader does 
things.  But perhaps these links will lead you in the right direction.


Shawn

Mat wrote:

My idea is to allow my viewers the ability to shorten/lengthen the
content of divs containing news articles on my archive page, much like
the safari reader does.

Would this be possible with jquery, and if yes, cross-browser
compatible?

Thanks, Mat.


[jQuery] Re: Big problem with Jquery

2009-05-25 Thread Shawn


It's not a problem at all.

I ran into this at one point myself.  The problem that there are 
multiple plugins doing the same thing and the uncertainty of which was 
the right one for me.  It turns out this is just part of the learning 
phase, I think.


As you start seriously looking at these similar plugins, you start to 
notice differences - sometimes blindingly obvious, sometimes very 
subtle.  These differences is what make or break the suitability of 
the plugin for your needs.


The bonus is that because there are similar and sometimes competing 
plugins, they ALL get better (or get left behind...).  But, there is no 
way any one plugin could ever be suitable for every situation they may 
be used in.  Coding is not a cookie-cutter type environment.  Sure there 
are some things that are incredibly common and have a number of 
quick-fix options.  But almost always these then need to be tweaked to 
fit anyways - sometimes substantially.


The better solutions - as determined by the community, and the active 
involvement of the authors (thereby gaining respect, trust, karma, etc) 
- tend to become recognized and/or adopted into the core set of 
plugins.  Some of these have been absorbed into the UI project, and I 
suspect more to follow (autocomplete and cluetip anyone? :) )


My final take on this...  Either you find a plugin that meets all your 
needs, or you have to write one yourself.  Each coder has to weigh the 
time/cost factors and make a decision for their environment.  There is 
no one answer to rule them all.


My thoughts.

Shawn

zweb wrote:

I really like jquery but I found one big issue with Jquery. There are
too many plugins for same task and it is very difficult to find a good
plugin that really works.

For example, I am looking for lightbox equivalent plugin for jquery. I
have tried 3 plugins so far and none of them is good and matches
anywhere close to the original lightbox plugin. I had similar problems
earlier with other UI plugins I was looking for.

Is there anyway to solve this problem? Is Jquery community trying to
address this problem?


[jQuery] Re: How to print json data, key and value

2009-05-20 Thread Shawn


Native JS is capable of this sort of thing.

For instance:

var obj = { p1: v1, p2: v2 };
for (p in obj) {
  document.write( p +  :  + obj[p] + br );
}

This would output:

p1 : v1
p2 : v2

Using the for..in loop structure, you can iterate over each of the 
properties of a given object.  In this case, p contains the name of 
the current property, and by doing obj[p], we treat obj as a hash 
object and get the value of the property in question.  The loop then 
moves on to the next property.


(disclaimer - the document.write() line is for sample purposes only, I'm 
assuming you'll using something more appropriate)


This will work with ANY object (assuming my memory isn't to far 
gone), but will not go into the tree structure.  If a propertie is 
another object, or array, then it's value would be displayed as 
[object].


HTH  And I hope this is what you were after.

Shawn

Massimiliano Marini wrote:

Hi Charlie,


I'm not good at explaining the exact terms javascript definitions for
value and key but they are javascript identifiers? change it to
what their values are in the array, works great


what I want to do is to print the name and the value of a json
object without knowing what the object has inside.

The only thing I know is that inside the json object there are only
[{name:value,name:value,name:value}], the object is not fixed lenght
and the name:value are not always the same.

Is it possible?



[jQuery] Re: [Autocomplete] - Doesn't always work

2009-05-19 Thread Shawn


There are a few different autocomplete plugins out there.  I'll assume 
you are using the one found at 
http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/  (which 
is the one documented at docs.jquery.com)  The author, Jorn Zaefferer, 
is on this list often


I've seen oddities like this with the plugin, but it pretty much always 
was a problem in how I was implementing the plugin.  Or a potential 
problem with my server side code or local network.  But I tend to do 
more than the absolute basics too, so I always assume it's my fault 
first.. :)


Short of seeing some sample code, I'm not sure how much more I can help 
out... But hope that points you towards the solution somewhat.


Shawn

MeanStudios wrote:

Greetings,

I'm currently using this awesome plugin for my web app but I'm having
a bit of an annoying bug with it.  It sometimes does not pull up any
results when typing in.  Like if I have something in the database with
the name March and I type in mar it shows the little loading.gif
but then disappears and doesn't give me any results.  If I tab away
and come back to it and try it again, then it will work.  And even
that doesn't make it work.  Sometimes I have to totally refresh the
page.  I thought it might be the cache mechanism so I turned that off
setting cacheLength to 1.
Any other ideas as to why it sometimes works and sometimes doesn't?


[jQuery] Re: Tell me , name of the jquery plugin for my requirement

2009-05-19 Thread Shawn


tablesorter with pagination?  And a search option?

The tablesorter plugin (http://tablesorter.com/docs/) works well for 
most my needs.


I haven't had to implement pagination yet, but I've seen a few plugins 
for this, and have heard of some combined with tablesorter.


The search option needs more details.  Do you want to search the 
contents of the table on screen?  Or search on the server side which 
then creates/replaces your table of data?  Either way, I think this can 
be accomplished without a plugin and very little code.  A simple text 
box where you capture the keypress events and look for the enter key (or 
make use of a go button beside the textbox).  Then this triggers an 
ajax call to update your table...


But, I recall seeing a more comprehensive plugin that combined all this 
- I think they called it data grid or something similar.  It was 
overly complex for my needs, but might suit your's


Hope that helps.

Shawn

bharani kumar wrote:

Hi all ,

Am looking one plugin must statisfy all my need , below is my need ,

Can u please tell me , which plugin is suitable for my requirement ,

* *



* Search Box*

*   Pagination *

*S.No(table sort)*



*Subject(sort)*



Date(sort)

*1*



Subject 1



09-08-1984

* *



 




 


* *



 




 


* *



 




 


* *



 




 


* *



 




 


* *



 




 






Thanks in advance 


B.S.Bharanikumar

POST YOUR OPINION
http://bharanikumariyerphp.site88.net/bharanikumar/


[jQuery] Re: [Autocomplete] - Doesn't always work

2009-05-19 Thread Shawn


I don't see anything tooo odd here.  Here's what I would suggest though:

1. Call the autocomplete function a few times manually.  Put the URL to 
it in the browser's address bar and load the page a few times (you'll 
need to switch your code to use $_GET though).  Try to mix up the speed 
of reloads, the data being passed, etc.  IF you see any blank pages, 
then you know the server side code is where the problem is at.  But if 
you always see output, continue debugging


2. Temporarily remove the .result() method just to ensure that is not 
causing confusion somewhere.  Commenting it out should be good enough.


3. Make sure you are using the most recent stable version of the plugin.

4. In your PHP code, where you are checking for no 'q' value and just 
exit the function replace that return with something like


  echo no criteria|0;
  return;

Just to see if this condition is the problem area.  Also, I'd probably 
change the condition to be   if (empty($q))  - which is a slightly 
better check.  That's a style thing though, so up to you


Now, with that out of the way...  Your PHP code seems odd to me.  Why 
pull back ALL clients and then do a string comparison to sort out what 
to show or not?  It is MUCH faster/more efficient to let the database do 
that filtering for you.  Do you have control of the Client class?  If 
so, can you add a search method that takes the 'q' value as a criteria 
for the name?  But, the code as is *should* run, so take my comments as 
constructive observations... :)


Shawn

MeanStudios wrote:

Shawn, yes, that is the plugin I am talking about.  In Jorn's blog
post on Autocomplete he said to post here with [Autocomplete] in the
subject if having problems.

Here's the code I'm using:

$(#client_name).autocomplete(/ac/get_clients/, {
scroll: true,
scrollHeight: 300,
autoFill: true,
cacheLength: 1,
max: 20,
matchContains: false
});

I also have a .result(function(){}); running after that as well so I
can populate a form with the returned data from the autocomplete.
I'm using CodeIgniter as my php framework utilizing a library called
DataMapper which is an implementation of an ORM.  Here's the function
I'm using to return the data:

function get_clients()
{
$c = new Client();
$c-get();
$q = strtolower($_POST['q']);
if ( ! $q)
return;
foreach ($c-all as $client) {
if (strpos(strtolower($client-name), $q) !== false) {
echo $client-name|$client-id\n;
}
}
}

On May 19, 5:36 pm, Shawn sgro...@open2space.com wrote:

There are a few different autocomplete plugins out there.  I'll assume
you are using the one found 
athttp://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ (which
is the one documented at docs.jquery.com)  The author, Jorn Zaefferer,
is on this list often

I've seen oddities like this with the plugin, but it pretty much always
was a problem in how I was implementing the plugin.  Or a potential
problem with my server side code or local network.  But I tend to do
more than the absolute basics too, so I always assume it's my fault
first.. :)

Short of seeing some sample code, I'm not sure how much more I can help
out... But hope that points you towards the solution somewhat.

Shawn

MeanStudios wrote:

Greetings,
I'm currently using this awesome plugin for my web app but I'm having
a bit of an annoying bug with it.  It sometimes does not pull up any
results when typing in.  Like if I have something in the database with
the name March and I type in mar it shows the little loading.gif
but then disappears and doesn't give me any results.  If I tab away
and come back to it and try it again, then it will work.  And even
that doesn't make it work.  Sometimes I have to totally refresh the
page.  I thought it might be the cache mechanism so I turned that off
setting cacheLength to 1.
Any other ideas as to why it sometimes works and sometimes doesn't?


[jQuery] Re: tutorial

2009-05-16 Thread Shawn


Any time you see something like

$(a).addClass(test);

You can assume this is JavaScript.  In particular, this is JS that makes 
use of the jQuery library.  JavaScript can only appear in certain places 
- either in an included .js library (via script type=text/javascript 
src=someLibrary.js/script), or within script tags.


Where jQuery is concerned, the $() method is not available until after 
the jQuery library has been included.  So make sure you include the 
library BEFORE doing anything that makes use of jQuery.


In addition though, you often don't want the jQuery code executed until 
the page is done loading.  In this case, if the addClass method is 
called before the HTML is rendered, then nothing will happen because the 
$(a) would return nothing.  In this case you want to make sure your 
command is put inside the .ready() method.  For example:


script type=text/javascript
  $(document).ready( function () {
$(a).addClass(test);
  });
/script

I haven't looked at the tutorial in years, but hopefully this is enough 
to help figure out what you need.


I might suggest though to maybe nail down the HTML know-how, and read up 
on basic JS.  Both will help make this all make sense.  As is you might 
be taking on too much all at once and overwhelming or confusing yourself 
- but that's how I learn too, so whichever works best for you.


BTW, Dreamweaver isn't a bad tool, but if you are working at this level, 
put Dreamweaver into Code View, and don't use the Design View at all. 
It might take a bit more to learn to start with, but you need to know 
how to do everything by hand eventually (i.e. no graphical tool to write 
code)... may as well start now.  My thoughts though.


Shawn

keithcoo wrote:

I went through part of the tutorial, and when i got to the section
adding and removing a css class i got stuck. the question i have is
this: do we add the$(a).addClass(test);  part to the html file
we created in the tutorial section The basics? if so, do we need to
delete some of the stuff we stuck in that file we created before we
add the $(a).addClass(test);   ?  im new to dreamweaver and
html and all this kinda stuff, so talk to me like im a beginner. if
the creaters of this tutorial are reading this, it would be helpful if
you gave an example of how the whole file would look for each section
of the tutorial, so that there is no confusion for guys like me.
thanks!

keith


[jQuery] New Linux.com and jQuery Group

2009-05-13 Thread Shawn


Hi gang.

Linux.com did an upgrade of their website today.  I didn't see any hint 
of jQuery in their community section so I created a group.  Feel free to 
check it out - I'd be happy to pass on the admin reigns to someone a 
little more active than myself.  Until then though


Linux.com
http://linux.com/index.php

Linux.com jQuery group:
http://linux.com/community/groups/viewgroup/240-jQuery

Shawn


[jQuery] Re: json syntax question (ticket vs unticked names)

2009-05-08 Thread Shawn


This all depends on where you are generating and using the json string.

Doing
  { key : value }

and then using that code immediately on the same page, typically works fine.

However, if you ever need to pass your json string to/from a server, 
you'll find that this shortcut fails quite often.


For instance, using this shortcut to request information via $.ajax(), 
often gives an odd error.  While the request has a 200 status (meaning 
the request succeeded without error), the error handler function (if 
specified) would trigger - even though it appears the json is correct. 
 (disclaimer - I haven't done this since 1.2.x days, so don't know if 
it's still the case)


To avoid these errors, use the standard and do

  { key : value }

especially when passing json via an http request (i.e to/from a server). 
 You'll have fewer problems in the long run.


My thoughts.

Shawn


aldana wrote:


i often see two different json styles to have names:

{ key : value }

vs

{ key :value }


looking at official sites only option 2 is correct syntax, never the less
most of the tools do also handle option 1 and don't moan about the syntax.

what you say, does it in practice not matter which option you choose?

generally i favor option 1 because it is not polluted with the . i wonder
why this syntax wasn't official from the start

thanks 


-
manuel aldana
aldana((at))gmx.de
software-engineering blog: http://www.aldana-online.de


[jQuery] Re: json syntax question (ticket vs unticked names)

2009-05-08 Thread Shawn


This isn't the same thing.  Consider the following code:

var json1 = { jack: jack jackson };
var json2 = '{ sara: sara jones }';

In this case, json1 becomes a javascript object in memory.  json2 is a 
string that just so happens to look like a javascript object.


In the first case, this is valid because JS handles things properly. 
This means you can use quotes or not for the property name - both work. 
(unless you have spaces or other special characters in the property name).


In the second case, the string will not get converted to a javascript 
object reliably in all cases.  Because it is not a standard json string.


Perhaps I mis-understood the original question, but I thought we were 
talking about instances where we were defining strings, in which case 
quoting is healthier.


I personally only use the quoted property names when I am building json 
strings - whether server side, or client side.  But if I just need to 
define an object client side, I don't usually bother.


So, I guess the distinction is what your target data type is - string or 
object.  With string, always quote.  With object, it's optional.


My thoughts.

Shawn


unwiredbrain wrote:

Actually, quoting is optional *EXCEPT* if member name contains spaces
or is a language-specific reserved word.

Try to jslint this fragment:

var JSONTest = {
jack johnson: john jackson,
alice: bob,
var: error
};

Unquoting alice makes no difference; doing the same for jack johnson
or var throws an error, but that's because we're dealing with
JavaScript: other languages could yeld errors on different reserved
words.

Then, in order to pre-emptively avoid such problems, my advice is to
*always* use member quoting.


[jQuery] Re: encode data in AJAX post?

2009-04-30 Thread Shawn


The data parameter expects key=value type definitions just like typical 
URLs.  So if you have simple data you might do


$.ajax({
   // ...
   data: item1=1item2=2,
   // ...
});

And build up that string however you need to.

If your data is in a form, you can use .serialize() or .serializeArray() 
to do this quicker.


i.e.
$.ajax({
   // ...
   data: $(#myForm).serialize(),
   // ...
});

If you have more complex data, but still relatively simple (i.e. would 
fit a simple key=value situation where value is not another complex 
object), then you can do something like:


var myData = {
  name: $(#name).val(),
  address: $(#address).val()
}
$.ajax({
$.ajax({
   // ...
   data: myData,
   // ...
});

The $.ajax() method will convert your object to an appropriate string.

If you need more complex data - like say an array of objects, then your 
best bet (IMO) is to create a custom JSON string to pass to your server.


// multiline for readability
var myJson = '{ [
  { name: ' + $(#name1).val() + ',
address: ' + $(#address1).val() + '
  },
  { name: ' + $(#name2).val() + ',
address: ' + $(#address2).val() + '
  }
]};
$.ajax({
   // ...
   data: json= + myJson,
   // ...
});

While the $.ajax() method will handle a simple object nicely, it fails 
when you have more complex objects - in my experience... I end up 
getting an array of [object Object] strings, rather than the objects 
themselves.  So I end up having to create my own JSON string, or using 
the array method of passing elements with the same name
(i.e. input name=person[] ), which I find to be hit and miss for 
back end language support.  PHP works fine, but ColdFusion doesn't like 
it (at least not when I tried).  So the JSON approach is cleaner in 
that it works better with all back end servers - they just need to 
decode the json string to an object and you can use it there.  (I'm 
actually hoping someone can tell me a better way to do this).


For the JSON approach, if it is a one off type thing, I'd say just code 
the string manually.  If you are doing this over and over, grab the JSON 
libraries and let IT build your string for you.  It is up to you to 
decide if you want/need the extra libraries loaded loaded though


Hope that helps.

Shawn



jb007nd wrote:

Do i need to encode my data send through AJAX post?

Ex.
var name = $(input#name).val();

var dataString = 'name='+ name;

///
$.ajax({
  type: POST,
  url: mail.ajax.php,
  data: dataString,
  dataType: html
 });

///

How can I do an URLecode?

thanks!


[jQuery] Re: Cycle Plugin - Can't Get Pause To Work

2009-04-23 Thread Shawn


Pause is working for me, with a catch.

If my mouse is not over the image, it cycles.  Placing my mouse over the 
image pauses the cycling.


Clicking the link brings up an overlay (?) and a form - at this point 
the mouse is not over the image, but over the overlay/form.  So the 
image cycles as it should.


I don't think you want the pause option here.  I think you want to 
progamatically start/stop the cycling.  See the section Manually 
Pausing a slideshow at http://malsup.com/jquery/cycle/int2.html.


HTH.

Shawn

Nic Hubbard wrote:

I am using the cycle plugin, but for some reason I can't get the pause
feature to work.  I am showing a hidden div, and when I do, I need to
pause the slideshow.
Here is what I am using:

$('#artistCycleParent').cycle({
fx:  'fade',
speed:3000,
timeout:  5000,
pause:  1,
next:   '#artworkNext',
prev:   '#artworkPrev'
});

// Pause the cycle
$('#pauseButton').click(function() {
$('#artistCycleParent').cycle('pause');
$(this).hide();
$('#resumeButton').show();
return false;
});

// Resume the cycle
$('#resumeButton').click(function() {
$('#artistCycleParent').cycle('resume');
$(this).hide();
$('#pauseButton').show();
return false;
});

The code looks ok to me, but it just does not seem to pause.

Example: http://www.caldwellsnyder.com/artists/montoya-ortiz/view-artworks
Click on Contact about artwork

Thanks.


[jQuery] Re: web site configuration

2009-04-20 Thread Shawn


If you do not know coding/javascript/DOM that well, I would suggest 
sticking with one page per change.


But, if you want to dive in...

Set up a div with an ID, and then use the load method to change it in JS 
when needed.


i.e.  (this has not been tested in any way)

div id=myslides/div
a href=# id=previousSlidePrevious/a
a href=# id=nextSlideNext/a
script type=text/javascript
 $(document).ready( function () {
  $(#nextSlide).click(function () {
   $(#myslides).load(myslide.htm);
  });
 });
/script

With a little logic in there you can easily decide what slide you want. 
 Then just put each of the slide content (image, html, etc) into it's 
own file and call that in the .load() function.


This approach can be simple, or it can get a little complex - especially 
if your loaded page includes other JavaScript to use.  But this is a 
well known type of issue that has been dealt with many times


HTH

Shawn

rince78 wrote:

Hi,
at present I give a favour for one of my friends. Unfortunately I'm
not really involved in programming web sites.
I'm calling a lot of javascripts for a slideshow and some other stuff.
for example:

script type=text/javascript src=highslide-full.js/script
script type=text/javascript src=highslide-with-gallery.js/
script
link rel=stylesheet type=text/css href=highslide.css /

I'm calling following scripts in the homepage, page prices and page
rooms.
It would be easier not to be constrained to call the scripts every
time on a new side.
Is there a simple example to create the button event by only calling a
new body? with Ajax or simple Javascript?

Thank you,
Bjoern from Germany


[jQuery] Re: value of this after many enclosures!

2009-04-08 Thread Shawn


Lwangaman wrote:

  alert(itsme.name);

// gives undefined


because a tablecell usually doesn't have a name attribute associated 
with it.  Remember that your itsme variable is a reference to a DOM 
element (not a jQuery element).  Which explains



  var itsyou = itsme.attr(name);
  alert(itsyou);
// gives no results, it actually stops everything from working.


You would need itsyou = $(itsme).attr(name);  But even then, if 
itsme is a tablecell, the name attribute likely doesn't exist.  Maybe 
try id instead?



  var itsyou = eccomi.find(input:checkbox);
  alert(eccoti);

// gives no results, it actually stops everything from working


if eccomi is a DOM element, then this would stop and likely throw an 
error ('find' not a property or object)...  Try it as


 $(eccomi).find(input:checkbox);

The core issue that I can see is understanding the difference between a 
DOM object/element and a jQuery object.  They are not the same, though 
they are often used in a very similar manner.


HTH.

Shawn


[jQuery] Re: HOWTO - hover card effect

2009-04-07 Thread Shawn


From what I can see of the effect visually (didn't look at code), this 
appears to be a simple creative use of a popup div positioned over the 
original image such that the image in the popup appears to not move.


As Giovanni mentioned, hover intent is part of the solution.  But I 
think you might get a similar type of effect with the ClueTip plugin 
(http://plugins.learningjquery.com/cluetip/), a little CSS and a little 
creative positioning.


Hope that helps.

Shawn

Giovanni Battista Lenoci wrote:


Jury ha scritto:

Hi all,

this effect seems to have no common name, let's call it hover card.
You may see how it works on this website - www.cn.ru/films - if you
hold a mouse over any cover art for 1-2 seconds (sorry it's Russian,
just can't find English examples). Does jQuery have any plugin similar
to that ?

Thanks,
Jury.
  

Are you reffering at the delay before the new content appears?

If so, you have to take a look at the hover intent plugin:

http://cherne.net/brian/resources/jquery.hoverIntent.html

Bye :-)



[jQuery] Re: How save is Jquery with JSON

2009-01-27 Thread Shawn Grover


Three options:

jsonp - allows ajax type requests to other domains
iframes - set the src attribute on an iframe to the remote page, use JS 
to extract the info you need from that frame
server side - do an http request via your server side code, extract what 
you need there, and make it available to your page as needed.


There may be more options for getting data from remote URLs, but these 
are what I have commonly seen.  The server side approach is probably the 
easiest and/or better performing option.


My thoughts.

Shawn

Trend-King wrote:

ok i understand

but how does plugins like thickbox or some balloon tips handle the get
from other domains.

in that plugins you can say get me the content from for example
google.

do they all manage this via iframe?

William schrieb:

You just described a basic XSS attack, browsers generally do not allow
cross-domain XHR because of that. You can get around it by using your
own domain as a proxy for JSONP.

On Jan 27, 2:43 pm, Trend-King i...@trend-king.de wrote:

hello i havea question about how saveis jquery and JSON.

i use $ajax({url:url,datatype:json...}) to get a markup of JSON items
that updates the dom of my page via the success function passing the
response to an function.
and $.each the items to update the html of the element.

in that funktion that manages the items i have a  markup before that
checks if the JSON got an markup of url to get. if it is so i pass
that url to another funktion of $ajax({url:that url...}) with gets me
the changed content for the middle of my page and updates the html.

so my question is how save this is. for example if there will be an
not from me url and gets the html for the middle of the page from
extern by injecting or hacking.

i hope i wrote this to understand my question...

greet and thanks for your reply


[jQuery] Re: getting to a variable in the parent frame - stumped

2009-01-24 Thread Shawn Grover


By declaring var module inside the function, that variable only exists 
inside the function.  If you need access to that variable outside the 
function, you need to either return it from the function (i.e. return 
module; ) or declare the variable in the global scope.  Something like this:


script
  var module = null;

  $(function () {
module = { . . . };  // reset the global variable to some value
  });
/script

Now you can refer to that module variable from inside your iframe with

  console.log( window.parent.module );

(Assuming I am remembering my terms right - it's been a long while since 
I needed to do this...)  In that statement, window refers to the 
current window - aka the frame.  parent refers to the element that 
contains the window if one exists (refers to itself if it IS the top). 
Global variables (and functions) are properties of the window - not the 
document.


Then only part I'm not sure on is the use of the $() function in your 
code.  I'm not sure if jQuery places the defined function on the global 
stack or not.  If so, then you shouldn't even need the first part


Hope that helps.

Shawn

jay wrote:

perhaps you need to do this.module = {...}? Doing var module makes it
private I believe

On Jan 23, 3:31 pm, jquertil til...@gmail.com wrote:

I'm using frames (don't ask) and have exhausted my abilities
(sniff)... here is some pseudo-code to illustrate the situation:

 first, CONTAINER.HTM:
script src=jquery.js/script
$(function(){

var module = {
   something1 : function(var1){
  alert(var2);
   }

}
});

iframe src=iframe1.htm/iframe

- now, IFRAME1.HTM
script src=jquery.js/script
$(function(){
   $('#myDiv').click(function(){
  top.frames[0].document.module.something1('hello');
  // this line above is the part where I'm stuck.
  //why won't this darn thing cooperate and alert my variable?
   });

});

div id=mydivclick me/div


[jQuery] Re: change image scr of all images in a page

2009-01-20 Thread Shawn Grover


Giovanni Battista Lenoci wrote:

Maybe I confused you.

You've mixed two types of syntax. You can achieve this with 2 syntax:

1.
$('img').each(function(){
$('img').attr({'src': http://localhost/s.demo/+$(this).attr('src')});
});

2.
$('img').each(function(){
$('img').attr('src',http://localhost/s.demo/+$(this).attr('src'));
});


You have a slight issue with the samples.  The first instance of 
$('img') inside the function() should be $(this).


Shawn


[jQuery] Covering multiple elements with a single function, but passing a variable?

2009-01-14 Thread Shawn

Hi.  I'm stuck trying to figure out the jQuery way to code this
functionality I have in my project.

Below is a stripped down example of what I'm trying to do.  When I
click the Add Item link below any list, I want to just append a new
element to the end of that list.  What I do now is just use an onclick
element for each anchor tag, and call addItem and pass the specific
list_id for that list.  The function then dynamically locates that
specific list and appends a new item.

What I have here works (excuse any typos, I'm writing from memory),
but I'd like to make it cleaner by getting rid of the onclick calls
and just having jQuery bind a function to the additem class.  I just
can't figure out how to pull in the list_id variable in each case.

Any ideas?

...
function addItem(list_id) {

  $('#list_'+list_id+'  ul').append('lidata/li');
  return false;

}
...
ul id=list_1
  lidata/li
  lidata/li
/ul
a class=additem href=# onclick=addItem(1);return false;Add
Item/a

ul id=list_2
  lidata/li
  lidata/li
/ul
a class=additem href=# onclick=addItem(2);return false;Add
Item/a
...


[jQuery] Re: Odd issues passing JSON to server [resolved]

2008-12-15 Thread Shawn Grover


Just to put an answer to this, in case someone else runs into it...

The problem was a PHP issue.  The problem line was

$data = json_decode($_GET[p]);

That line is perfectly fine, and the p var does have data.  However 
the quotes in the string were automatically escaped.  So the line needed 
to be changed to read


$data = json_decoe(stripslashes($_GET[p));

At which point it worked as expected.

Shawn

Shawn Grover wrote:


I'm not sure if I have a server side issue or a client side issue.  The 
problem is that I am generating a JSON string in my plugin, and passing 
it to a php page (though the back end shouldn't matter in the long run). 
 I can see that a parameter is infact passed, but trying to decode that 
string is giving me nothing - not even errors.  Sooo, I'm stuck not 
knowing if the json string is invalid, or I'm doing something wrong on PHP.


I have a pastie with the code in question at http://pastie.org/338246.

Any tips are appreciated.  Thanks.

Shawn


[jQuery] Odd issues passing JSON to server

2008-12-13 Thread Shawn Grover


I'm not sure if I have a server side issue or a client side issue.  The 
problem is that I am generating a JSON string in my plugin, and passing 
it to a php page (though the back end shouldn't matter in the long run). 
 I can see that a parameter is infact passed, but trying to decode that 
string is giving me nothing - not even errors.  Sooo, I'm stuck not 
knowing if the json string is invalid, or I'm doing something wrong on PHP.


I have a pastie with the code in question at http://pastie.org/338246.

Any tips are appreciated.  Thanks.

Shawn


[jQuery] Re: getBoxObjectFor() is deprecated

2008-11-26 Thread Shawn Grover


I see this occasionally, but on pages that I didn't write, or even use 
jQuery.  This is a FF issue, I believe  I could be wrong though...


Shawn

edzah wrote:

Well I am getting the same error and I'm not using the flash plugin.
Anyone else get this?

Ed

**Since I can't reopen this old topic**

Pete wrote:

I keep seeing this error message from time to time on a site that I'm
working on.
*Use of getBoxObjectFor() is deprecated. Try to use
element.getBoundingClientRect() if possible.*

The site still seems to work fine, it's just an annoying error.

I have a feeling it has something to do with the jquery flash plugin I'm
using, but I can't find an answer for it.  Anyone have any ideas?

Thanks,
-pete


[jQuery] Re: How to find the first parent?

2008-11-24 Thread Shawn Grover


$(#myElement).parent();

Shawn

Debby wrote:

How to find very first parent of perticular element?


[jQuery] Re: get top most parent

2008-11-24 Thread Shawn Grover


$(#header2).children(p.submenu);

or
$(#header2).find(.submenu);

or make use of context:

$(.submenu, #header2);

- read that as all items with class of .submenu under the #header2 
object.  The #header2 part can be a selector, DOM element, or jQuery 
object.


HTH

Shawn

Liam Potter wrote:


header2obj.children().children().children(#submenu);



chitgoks wrote:

hi, i am stumped so i am posting it here. no luck searching google for
many hours

this is my html code

div id=firstpane class=menu_list !--Code for menu starts here--
  p id=header1 class=menu_headHeader-1/p
div class=menu_body
a href=#Link-1/a
a href=#Link-2/a
a href=#Link-3/a
/div

p id=header2 class=menu_headHeader-2/p
div id=header2_menubody class=menu_body

div id=pane class=menu_list
p id=submenu class=menu_headSub-Menu/p
div class=menu_body
a href=#Sub Link-1/a
a href=#Sub Link-2/a
a href=#Sub Link-3/a
/div
/div

a href=#Link-1/a
a href=#Link-2/a
a href=#Link-3/a
/div

p id=header3 class=menu_headHeader-3/p
div class=menu_body
a href=#Link-1/a
a href=#Link-2/a
a href=#Link-3/a
   /div
/div  !--Code for menu ends here--

if i have access to the object id header2 how can i get access to
id=submenu ?
i tried header2obj.children('.menu_head') but it doesnt work. thanks
  




[jQuery] Re: Instantiating multiple plugin instances on the same page

2008-11-24 Thread Shawn Grover


Depends how your plugin is set up.

If you didn't implement the chaining techniques, then chances are you 
only have one instance.  But if you did implement chaining, you *should* 
have multiple instances.


Do you have something like this line in your plugin?

return $(this).each( function () {
  // plugin code goes here
});

If you can post your code, we can help more.  OR, you can go to the 
#jquery channel on IRC and use a pastie (www.pastie.org) to get some 
more interactive help...


Hope that helps some.

Shawn

howardk wrote:

Is there a way of instantiating multiple instances of a plugin on the
same page?

What I have essentially is an animated effects plugin, and I want to
be able to invoke separate instantiations of it, doing something like
the following:

script
$( '#effect_1' ).animEffect( { name: 'jumper', color: 'ff', fps:
30 } );
$( '#effect_2' ).animEffect( { name: 'round-the-moon', color:
'00', fps: 40 } );
/script

div id='effect_1'/div
div id='effect_2'/div

I'm still fairly new to javascript. As far as I can tell though, it
looks like it can't be done, since as far as I can see, each plugin
invocation is really calling the same function object over and over
again (thereby overwriting whatever instance or local variables might
have been set in a prior invocation).

Is this correct? Is there a way of doing this, or am I out of luck?
Howard


[jQuery] Re: How to create own jQuery plugin?

2008-11-18 Thread Shawn Grover


http://www.learningjquery.com/2007/10/a-plugin-development-pattern

This assumes some basic jQuery knowledge, but gives a nice how and why 
of building a better plugin.  (hope this info is still current cuz I use 
it often)


Shawn

Debby wrote:

Hello,

Can anybody expalin how to create own jQuery plugin?
Some basic stuff..
Guidelines to follow..


[jQuery] Modernized Portlets?

2008-11-15 Thread Shawn Grover


I found the jQuery Portlets at 
http://sonspring.com/journal/jquery-portlets.  This appears to be 
outdated (makes use of the interface library for the sortables rather 
than ui.jquery...).  Does anyone know if there is a more current version 
of this?  And one that doesn't necessarily depend on tables would be 
nice too...


If there isn't one, I guess I'll have to update it...  A customer wants 
this sort of functionality


Thanks for any tips...

Shawn


[jQuery] Re: Modernized Portlets?

2008-11-15 Thread Shawn Grover


Thanks Karl, but that is a poor imitation of what is needed (for my 
customer's needs).  Or perhaps I'm not understanding how to work 
with that code quite right?


I have a functional sample of what I'm after here 
http://grover.open2space.com/files/dev/panels/index.htm - click the 
titlebars to collapse, and the maximize button to expand even more. 
The panels can be dragged around, and Panel 3 is mandatory - it cannot 
be collapsed.


There are still issues here though - dragging panel 2 into the first 
column, and then you cant add to the second column.  And placeholders 
are not showing while dragging.


I stumbled across the portlets while working on this and was hoping 
there might be something a little more complete and modern.  Guess I'll 
keep plugging away at this


Shawn

Karl Swedberg wrote:

Hey Shawn,

There is a rudimentary one in the jQuery UI demos:

http://ui.jquery.com/repository/real-world/layout/

--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Nov 15, 2008, at 5:31 PM, Shawn Grover wrote:



I found the jQuery Portlets at 
http://sonspring.com/journal/jquery-portlets.  This appears to be 
outdated (makes use of the interface library for the sortables rather 
than ui.jquery...).  Does anyone know if there is a more current 
version of this?  And one that doesn't necessarily depend on tables 
would be nice too...


If there isn't one, I guess I'll have to update it...  A customer 
wants this sort of functionality


Thanks for any tips...

Shawn




[jQuery] Re: A real modal window... is it possible?

2008-11-14 Thread Shawn Grover


This is a coding approach issue, rather than a modal window issue.  To 
me at least.


When I needed behavior like this, I wrote my code in such a way that a 
function was called that set up the environment and then opened the 
modal window.  Now that the modal window is open, I know that nothing 
else should be receiving events, so there is no code to execute other 
than for the modal stuff specifically.  Now when the window is closed, I 
call the appropriate function (cancel, save, etc) and continue 
processing from there.  In this way, my processing has stopped until 
the Modal window triggers the next part of processing.


Of course, this is not the answer for all cases.  But, working in an 
asynchronous and event driven environment, this tends to work well enough.


To acheive what you are asking for would be possible if you were working 
in a synchronous or procedural environment.  But that doesn't describe a 
web page per se


My thoughts...

Shawn

Richard D. Worth wrote:
What I mean to say is, a modal isn't about stopping flow of code. It's 
about restricting interaction to a certain set of elements, until the 
interaction is complete. So it allows interaction with elements in that 
modal (requiring code flow - remember javascript is single-threaded), 
preventing interaction with all others, until it's closed.


If you're wanting to call a modal like a function and have it return a 
value (think confirmation dialog), it won't work to block like that. An 
alternative pattern is to provide a callback function that will resume 
execution after the modal is closed.


- Richard

On Fri, Nov 14, 2008 at 4:48 PM, Eric Martin [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:



I guess it depends on what you mean by flow of code must STOP.

On Nov 14, 12:11 pm, Wagner [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:
  Is it possible to make a window like jqModal, etc, etc,  BUT WITH A
  REAL MODAL way of work?
 
  I mean the flow of code must STOP until the window be closed!
Does
  it exist?




[jQuery] Re: Animating table rows

2008-11-13 Thread Shawn Grover


Another option is to wrap each of your TDs within the row with a DIV. 
Then you can do something like $(#myRow div.animateMe).slideUp(); 
Then the row has no vertical height because it's content is now invisible.


Just a thought

Shawn

Karl Swedberg wrote:

Chris,

The .fadeIn() and .fadeOut() might be an acceptable compromise.

By the way, IE doesn't understand display: table-row, so if I recall 
correctly the display: block actually works there.


--Karl


Karl Swedberg
www.englishrules.com http://www.englishrules.com
www.learningjquery.com http://www.learningjquery.com




On Nov 13, 2008, at 9:11 PM, c.barr wrote:



Hmm, well that's too bad.  I actually tried to do a custom .animate()
with a height from 0 to the corrcet height, but that's the same issue
- it sets it to display:block.

The closest I've come is to do my animation, and then do a callback
when it finishes of .css(display,table-row) - which works, but it
only looks correct once it's finished animating - and the animation
looks all messed up - so that defeats the purpose.

Oh well, thanks for the info anyway!

On Nov 13, 8:06 pm, ricardobeat [EMAIL PROTECTED] wrote:

It's impossible to animate a table row's height to/from 0. Try setting
the tr height less than the text height, it doesn't work. Only block
elements can use this effect :)

On Nov 13, 9:06 pm, c.barr [EMAIL PROTECTED] wrote:


I'm creating an admin section for a site where I need to dynamically
add a new row to a table - which I know how to do just fine, but the
problem is that when you do an animation like .slideDown() jQuery sets
it to display:block; and for a table row this is incorrect, as it
should be display:table-row;



The result is it basically screws up the table formatting. Here's a
demo:http://jsbin.com/alemi



Sure I can just do a plain .show() with no animation to show it, but
then why both even using jQuery.  Is there a way to fix this behavior?




[jQuery] Sortable type behavior?

2008-11-12 Thread Shawn Grover


I need to allow the user to re-order a number of DIVs on the screen, 
each of which contains a title DIV that would be the drag handle.  UI's 
sortables seems almost perfect, but I don't see how I can apply it to 
the divs in my case...  Any suggestions?


A sample div might look something like:


| title|

|  |
|  content |
|  |


or

div class=container
  div class=titleMy Title/div
  div class=contentSome content here/div
/div

Thanks in advance.

Shawn


[jQuery] Re: Event Capture Architecture

2008-11-12 Thread Shawn Grover


For ease of coding, a separate bind method for each element is pretty 
straight forward.  However when you are dealing with a large number of 
elements, and your processing needs to look at those large number of 
elements, then performance can get to be a problem.


For instance

$(.myclass).click( function () { ... });

This looks innocent enough, but if you have hundreds, or even thousands 
of elements on the page, then finding all the .myclass elements can 
take a while.  Of course, narrowing down the selector helps - 
div.myclass for instance.


I found this problem to be especially visible when dealing with a very 
dynamic page.  (mine was a calendar type application where LOTS of info 
via Ajax that would result in updating the calendar and needing to 
reapply handlers).


In cases like this, you'll probably be better off applying the click 
handler to a container element if possible, then using the event.target 
element to look at the element throwing the event.


Oh, and if you need more data for processing than just the ID, don't 
forget about the jQuery.data() method


HTH

Shawn

saqib wrote:

I am developing an application in which I have to define click events
for many elements( the list may go up to hundreds). So what would be
the best way to capture these event

Either using a *
 bind( $('*') );
and in click function get the id of target element and code
accordingly


OR use a separate bind method for every element.
$('#elementID').click(function(){
bind( );
});


[jQuery] Remove CSS setting (not class)?

2008-11-11 Thread Shawn Grover


I have an odd situation where a DIV can be displayed in one of 3 states:
- normal (X x Y pixels in dimension),
- minimized (hidden)
- maximized - the height value removed so that the div grows/shrinks to 
show the contents of the div.


The first two are done, but I'm hitting a wall on the maximized bit.  
Perhaps because it's WAY past bed time for me.


I've tried $(#myElement).css(height, ); with no luck.  I don't 
want to just say 100%, because some content may only be a line or two, 
while others may be XXX pages...


Thanks for any tips.

Shawn


[jQuery] Re: Remove CSS setting (not class)?

2008-11-11 Thread Shawn Grover


Thanks - auto did the trick.

I might be back in a bit with questions about animating this, but I'm 
looking at the animate() method first...


Shawn


Liam Potter wrote:



$(#myElement).css(height, auto);


MorningZ wrote:

try

$(#myElement).css(height, null);



On Nov 11, 7:52 am, Shawn Grover [EMAIL PROTECTED] wrote:
 
I have an odd situation where a DIV can be displayed in one of 3 
states:

- normal (X x Y pixels in dimension),
- minimized (hidden)
- maximized - the height value removed so that the div grows/shrinks to
show the contents of the div.

The first two are done, but I'm hitting a wall on the maximized 
bit.  Perhaps because it's WAY past bed time for me.


I've tried $(#myElement).css(height, ); with no luck.  I don't
want to just say 100%, because some content may only be a line or 
two,

while others may be XXX pages...

Thanks for any tips.

Shawn







[jQuery] Re: pirobox plugin released

2008-11-11 Thread Shawn Grover


I'd think that leaving the spaces and such in there make it more 
readable.  And the more readable, the more reusable the code is by 
others.  If you really want lightweight, then minimize or pack the 
library and use that version.  But the developer version should be as 
developer friendly as possible...


Of course this is just my opinion, and you are free to do as you wish.. :)

Shawn

diego wrote:

You mean this http://www.pirolab.it/pirobox/js/pirobox.js ??
unreadable?

I changed all the original variables and removed all the spaces to get
the script more lightweight.
Just this :)

On 12 Nov, 01:47, Isaak Malik [EMAIL PROTECTED] wrote:
  

I just peeked at the source code and I'm wondering if this is the original
version? It's quite unreadable.

And of course, copyright notice will be kept untouched



On Wed, Nov 12, 2008 at 1:43 AM, diego [EMAIL PROTECTED] wrote:



This is great, the only thing i ask, is to leave my name up there in
the js, and if you want, a link back to my page :)
  
Diego
  
On 12 Nov, 01:38, Isaak Malik [EMAIL PROTECTED] wrote:
  

Oh, I didn't see the unpacked version and it was right under it... Thanks


:)
  

I may use this in a current project after some testing :)

On Wed, Nov 12, 2008 at 1:34 AM, diego [EMAIL PROTECTED] wrote:


Hi Isaak,i really hate explorer i work with firefox, for debug my
script,and when i open explorer i'm really scared of what can
happen..
sure that is open source, you can download both version, packed and
unpacked,just click the anchor  'download' on the nav.
  
Diego
  
On 12 Nov, 01:27, Isaak Malik [EMAIL PROTECTED] wrote:
  

It doesn't sound strange at all, we can expect anything from IE ;)

It is very interesting indeed but what about the license + source


code?
  

Is
  

this an opensource library, if so can you also provide a non-packed


version?
  

On Wed, Nov 12, 2008 at 1:13 AM, diego [EMAIL PROTECTED]


wrote:
  

Hi Isaak, i've tested it in ie6/7, ff2/3 , safari mac/pc , opera
9.5/9.6 , G. chrome, and the only problem i found it's with ie7,the
animation is not as smooth as in firefox, it may sound strange but
  

it
  

works better with IE6, and not with ie7.
It's ok in opera safari e chrome.
The best performance is obviously in firefox, then chrome, safari,
opera, IE6, and last ie7.
  
Diego
  
On 12 Nov, 00:59, Isaak Malik [EMAIL PROTECTED] wrote:
  

Very interesting piece of work :), have you performed


cross-browser
  

tests?
  

On Wed, Nov 12, 2008 at 12:55 AM, diego [EMAIL PROTECTED]


wrote:
  

Hi all, i've finished my first plugin, hope you like it, any
  

question
  

or opinion it's welcome.
  
http://www.pirolab.it/pirobox/
  
I developed this plugin, by studying the docs.jquery, it's
  

amazing
  

what you can do with this library.
  
Tnx to all the jquery developers.
  
Diego Valobra
  

--
Isaak Malik
Web Developer


--
Isaak Malik
Web Developer


--
Isaak Malik
Web Developer


--
Isaak Malik
Web Developer





[jQuery] Re: Panel Interface for webpage?

2008-11-10 Thread Shawn
Thanks Rene.  Didn't find anything promising there though... but great 
resource!

Shawn

On Sunday 09 November 2008 21:46:01 Rene Veerman wrote:
 Shawn wrote:
  I'm not sure if I've seen a plugin for this, or even a website, but
  thought I'd ask here before creating custom code
 
  We're looking to have panels (aka widgets) on the page. (A
  dashboard perhaps?) Each panel is a given size - say 100x100, has a
  title bar, and minimize/maximize options, and a Show More link at
  the bottom of the panel. The web page may have many panels (scrolling
  the page as needed).
 
  Each of these panels would (presumably) contain the output from
  various applications within the Intranet.
 
  There is a little more logic involved - manadatory panels, etc - but
  this covers the core.
 
  I'm looking for any tips/suggestions on this... I can build something
  (ajax calls, iframes, etc... should be pretty straight forward), but
  would rather not have to, unless really needed. Thanks for any responses.
 
  Shawn

 you might wanna check http://ajaxrain.com




[jQuery] Panel Interface for webpage?

2008-11-09 Thread Shawn
I'm not sure if I've seen a plugin for this, or even a website, but thought 
I'd ask here before creating custom code

We're looking to have panels (aka widgets) on the page.  (A dashboard 
perhaps?)  Each panel is a given size - say 100x100, has a title bar, and 
minimize/maximize options, and a Show More link at the bottom of the panel.  
The web page may have many panels (scrolling the page as needed).

Each of these panels would (presumably) contain the output from various 
applications within the Intranet.

There is a little more logic involved - manadatory panels, etc - but this 
covers the core.  

I'm looking for any tips/suggestions on this...  I can build something (ajax 
calls, iframes, etc... should be pretty straight forward), but would rather 
not have to, unless really needed.  Thanks for any responses.

Shawn



[jQuery] Re: [HELP] How do I get attribute's value of selected node ?

2008-11-09 Thread Shawn
Need a little more detail.  How are you selecting a node?  

If I assume for a moment you have a class called myClass on the 
nodes/elements that can be selected, and that you are selecting these nodes by 
clicking on them, then you can get the ID like this:

$(.myClass).click( function () {
  var theID = $(this).attr(id);
  // ... do something with the id 
});

You can get ANY attribute using the .attr() method.

HTH

Shawn

On Sunday 09 November 2008 19:30:45 Pham Anh Tuan wrote:
 Hi all,

 I'm stucking in this trouble about 2 hours T___T 

 Because I have to get data from server by ID of selected node, and till now
 I found no way to get it :(

 Plz help and show me how to get the value of ID Atrribute of selected node
 in JQuery TreeView?

 Thanks for reading,

 bowlkhin




[jQuery] Re: How to solve this

2008-11-04 Thread Shawn
Or submit the form from code:

$(input[type='submit').click( function () {
  $(#informUserText).show();
  $(form).submit();
  $return false;
});

On Tuesday 04 November 2008 13:53:51 Mauricio (Maujor) Samy Silva wrote:
 Do not cancel the default action for the click event with the statement

 return false;

 Try to remove that line from your code.

 Mauricio

 -Mensagem Original-
 De: Johny [EMAIL PROTECTED]
 Para: jQuery (English) jquery-en@googlegroups.com
 Enviada em: terça-feira, 4 de novembro de 2008 14:49
 Assunto: [jQuery] How to solve this

  I have a form
 
  form method=post action=MyURL enctype=multipart/form-data
   input type=hidden name=token value=12/
  pinput type=submit value=Go/p
  /form
 
  The form uploads a large file so that I would like to inform a user to
  wait, after he pushes the submit button.
 
  So I have
  ...
  ...
 
  $('[EMAIL PROTECTED]').click(function() {
  $('#InformUserText').show();
 
return false;
  });
 
  
  
 
  The text ( see InformUserText) is shown but the action script from the
  form, see MyURL, is not called.
  Can you please help how to say to a user that he should wait and the
  script is running?
  Thank you
  Lad.




[jQuery] Re: reading values from HTML tables

2008-10-31 Thread Shawn

I *think* the following will get you started:

$(#veh_odometer).children(tr).each( function () {
  //'this' refers to the current tr
  var address = $(td:eq(2), this).text();
  console.log(VALUE:  + address);  
  // note: console.log works in Firefox.  
  // Substitue an alert if desired

  // . . . Other processing here . . .
});

Two points here though:

- The $(#veh_odometer).children(tr) bit can be done in a few different 
ways.  But this should work (unless the the tbody element is needed too...).  
For instance you can say $(#veh_odometer  tbody  tr).each() for 
effectively the same results experiement for the method that works best 
for you.

- the var address line.  We are using a context reference here - we are 
saying give me the third TD in the context of the current row (this).  Again, 
more than one way to do this...  $(this).children(td:eq(2)) would do the 
same ( I think ).

Anyways, hope that helps.

Shawn

On Thursday 30 October 2008 23:29:52 GrootBaas wrote:
 Hi all,

 Any help would really be much appreciated.

 I have a table, how can I read the cell values of the table ...

 Currently I have ...


 function test () {

 var address;
 var i;

 for (i=1;
 idocument.getElementById('veh_odometer').rows.length; i++)
 {

 address =
 document.getElementById('veh_odometer').rows[i].cells[2].data;
 alert('VALUE: '+address)
 }

}

 I do loop through the table, but my variable address is undefined.
 Any ideas?




[jQuery] Re: reading values from HTML tables

2008-10-31 Thread Shawn

Correction.  Console.log works with FireBUG, which is a FireFOX plugin... 
sighs... I should just go to bed.. :)

Shawn

On Friday 31 October 2008 00:45:08 Shawn wrote:
 I *think* the following will get you started:

 $(#veh_odometer).children(tr).each( function () {
   //'this' refers to the current tr
   var address = $(td:eq(2), this).text();
   console.log(VALUE:  + address);
   // note: console.log works in Firefox.
   // Substitue an alert if desired

   // . . . Other processing here . . .
 });

 Two points here though:

 - The $(#veh_odometer).children(tr) bit can be done in a few different
 ways.  But this should work (unless the the tbody element is needed
 too...). For instance you can say $(#veh_odometer  tbody  tr).each()
 for effectively the same results experiement for the method that works
 best for you.

 - the var address line.  We are using a context reference here - we are
 saying give me the third TD in the context of the current row (this). 
 Again, more than one way to do this...  $(this).children(td:eq(2)) would
 do the same ( I think ).

 Anyways, hope that helps.

 Shawn

 On Thursday 30 October 2008 23:29:52 GrootBaas wrote:
  Hi all,
 
  Any help would really be much appreciated.
 
  I have a table, how can I read the cell values of the table ...
 
  Currently I have ...
 
 
  function test () {
 
  var address;
  var i;
 
  for (i=1;
  idocument.getElementById('veh_odometer').rows.length; i++)
  {
 
  address =
  document.getElementById('veh_odometer').rows[i].cells[2].data;
  alert('VALUE: '+address)
  }
 
 }
 
  I do loop through the table, but my variable address is undefined.
  Any ideas?




[jQuery] Re: Howto Question

2008-10-31 Thread Shawn
Or, don't use hover.  If you make the users click the link instead of just 
hovering over the link, then you basically have a toggle.  (there is a 
.toggle() method as well for this sort of thing...)

Or you can use a timer.  When the hover ends, start a timer.  Then clear/reset 
that timer if the mouse moves over the revealed area or the original link.  If 
the timer is allowed to end, then do the usual fade() bit.  The length of time 
for this is up to you... 500 ms, 1 sec, etc...  The hoverIntent plugin might 
help out with this.

Some thoughts.

Shawn

On Friday 31 October 2008 03:57:13 searly wrote:
 Hmm ... i think i have tried this before. here is a problem though i
 encounter, not sure if i will encounter this again:

 The link is wrapping an image (larger then #myContainer), then when
 hovering over the image the #myContainer fades in as expected
 overlaying the image, containing a number of links / text. However now
 if i hover over #myContainer to click on one of the links the
 #myContainer fades out and i can't click on the links. I guess i could
 work round this by doing this:

  a id=myLink
img ... /
div id=myContainer ... /div
  /a

 ... so wrap the div within the link? not sure if this would work, also
 it somehow doesn't look great ...

 thanks
 Andi

 On Oct 30, 11:22 pm, Shawn [EMAIL PROTECTED] wrote:
  Off the top of my head, and without looking at the site in question
  (sorry, a bit pinched for time...)
 
  Build your HTML.  Use CSS to position things where you want.  For
  example, a DIV with an absolute position.  Then when you are happy with
  the positionin/layout, set the container to display: none.  Give that div
  (or container) an ID.  Now you can do something like this:
 
  $(document).ready( function () {
$(#myLink).hover(
  function () { $(#myContainer).fadeIn(); },
  function () { $(#myContainer).fadeOut(); }
);
 
  });
 
  I may have the .hover event wrong (docs aren't loading for me right this
  moment...)  But this should get you started.  You may be able to use
  the .toggle() method as well - up to you.
 
  Btw, simple fading requires no additional plugins.
 
  HTH
 
  Shawn
 
  On Thursday 30 October 2008 16:37:47 searly wrote:
   Hi there,
  
   sorry if this is the wrong place to post this, I am fairly new to
   jQuery and wonder if somebody could help me.
  
   On the front page of the JQuery website are three links
  
   1. Lightweight Foot Print
   2. CSS3 Compliant
   3. Cross-browser
  
   When hovering over the links an area fades in  (transparent) and when
   leaving the area the area fades out again. The area seems to contain
   paragraphs etc.
  
   I wonder if somebody knows with which plugin this was achieved, as i
   want to do sth. similar whereby an area with a number of further links
   fades in.
  
   Thank you very much




[jQuery] Re: Howto Question

2008-10-30 Thread Shawn

Off the top of my head, and without looking at the site in question (sorry, a 
bit pinched for time...)

Build your HTML.  Use CSS to position things where you want.  For example, a 
DIV with an absolute position.  Then when you are happy with the 
positionin/layout, set the container to display: none.  Give that div (or 
container) an ID.  Now you can do something like this:

$(document).ready( function () {
  $(#myLink).hover(
function () { $(#myContainer).fadeIn(); },
function () { $(#myContainer).fadeOut(); }
  );
});

I may have the .hover event wrong (docs aren't loading for me right this 
moment...)  But this should get you started.  You may be able to use 
the .toggle() method as well - up to you.

Btw, simple fading requires no additional plugins.

HTH

Shawn

On Thursday 30 October 2008 16:37:47 searly wrote:
 Hi there,

 sorry if this is the wrong place to post this, I am fairly new to
 jQuery and wonder if somebody could help me.

 On the front page of the JQuery website are three links

 1. Lightweight Foot Print
 2. CSS3 Compliant
 3. Cross-browser

 When hovering over the links an area fades in  (transparent) and when
 leaving the area the area fades out again. The area seems to contain
 paragraphs etc.

 I wonder if somebody knows with which plugin this was achieved, as i
 want to do sth. similar whereby an area with a number of further links
 fades in.

 Thank you very much




[jQuery] [autocomplete] Some random questions

2008-10-26 Thread Shawn

1.  Is there any difference between Jorn's autocomplete from his webpage 
(http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/) and the 
one included in jQuery.ui 1.6rc2 ?  I can see the copyright info is the same, 
but don't see a version number for the autocomplete element...

2. Using the jquery.ui version of autocomplete, what steps are needed to make 
the autocomplete work properly in a modal dialog via jquery.ui's dialog?  (my 
initial tests show the code working, but the result area is not showing - I'm 
using a theme from the themeroller if that matters).  I'm using a local data 
set for now.

3. It's been about a year since I last looked at autocomplete.  Anything new 
that I should be aware off?  (I was using Jorn's plugin back then as well...)

Thanks for any info.

Shawn


[jQuery] Re: [autocomplete] Some random questions

2008-10-26 Thread Shawn

Thanks Jorn.

I can say that I've tested the integration of autocomplete and dialog now. :)  
So far so good.

What I was missing was the change from .autocomplete(url/data, options) 
to .autocomplete({url: , data:, etc.}).  Once I found that the plugin 
worked fine.  I have not seen any errors per se.  However I did notice 
the .result() is not binding (or perhaps I'm using it wrong... was planning 
on looking into that today).

But, if autocomplete will not be included until 1.7, then I should probably 
just use your plugin, rather than UI's version.

Thanks for the info.

Shawn



On Sunday 26 October 2008 06:27:30 Jörn Zaefferer wrote:
 My plugin was planned for inclusion in 1.6, but won't be part of the
 final release, it was deferred to 1.7. The UI version is adapter to
 the UI API and has two or three new features.

 A list of changes since the 1.0 release is here:
 http://jquery.bassistance.de/autocomplete/changelog.txt (1.0.2 just
 fixed some missing semicolon)

 There hasn't been any testing or documentation effort for integration
 of dialog and autocomplete. I've created a ticket for that:
 http://ui.jquery.com/bugs/ticket/3519

 Jörn

 On Sun, Oct 26, 2008 at 8:42 AM, Shawn [EMAIL PROTECTED] wrote:
  1.  Is there any difference between Jorn's autocomplete from his webpage
  (http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/) and
  the one included in jQuery.ui 1.6rc2 ?  I can see the copyright info is
  the same, but don't see a version number for the autocomplete element...
 
  2. Using the jquery.ui version of autocomplete, what steps are needed to
  make the autocomplete work properly in a modal dialog via jquery.ui's
  dialog?  (my initial tests show the code working, but the result area is
  not showing - I'm using a theme from the themeroller if that matters). 
  I'm using a local data set for now.
 
  3. It's been about a year since I last looked at autocomplete.  Anything
  new that I should be aware off?  (I was using Jorn's plugin back then as
  well...)
 
  Thanks for any info.
 
  Shawn




[jQuery] jQuery.ui modal dialog with themeroller theme?

2008-10-23 Thread Shawn

I'm finding that if I use any of the themes generated by the ui themeroller, I 
cannot use them with a modal dialog.  The form elements cannot receive 
focus..  But if I switch to a non-modal dialog everything works.

Anyone know any way around this?  I really do need modal dialogs, but do not 
understand the CSS well enough to role my own (at the moment..).

Thanks.

Shawn


[jQuery] Re: (Resolved) jQuery.ui modal dialog with themeroller theme?

2008-10-23 Thread Shawn

Figured it out.  Accidently. :)

If the  ui-dialog class is manually assigned to the dialog container before 
opening the modal dialog, the text boxes do not work right.  However, if the 
class is not manually assigned and just treated normally, the text boxes work 
fine.  

I.e.  the following code fails:

$(#dialogContainer).remove();
var dc = $('div id=dialogContainer class=ui-dialogcontent/div');
$(body).append(dc);
$(#dialogContainer).dialog({
title : Organization,
modal: true,
width: 650,
height: 350,
overlay: { opacity: 0.5, background: black },
});


But changing the var dc= line to 

var dc = $('div id=dialogContainercontent/div');

and the above code works great.  (assuming your content has some text boxes 
in it of course...)

Funny how sometimes forgetting to add a class in can lead to such 
discoveries.. :)  Hope this helps someone out.

Shawn.

Odd.  in my same project, with similar code, The modal dialogs work fine.
On Thursday 23 October 2008 22:32:36 Shawn wrote:
 I'm finding that if I use any of the themes generated by the ui
 themeroller, I cannot use them with a modal dialog.  The form elements
 cannot receive focus..  But if I switch to a non-modal dialog everything
 works.

 Anyone know any way around this?  I really do need modal dialogs, but do
 not understand the CSS well enough to role my own (at the moment..).

 Thanks.

 Shawn




[jQuery] Re: [TUTORIAL] Create a professional interface for your web applications using jQuery

2008-10-22 Thread Shawn

Not a bad tutorial.  !

But... :)

In your code you are doing things like 

# var windowHeight = document.documentElement.clientHeight;  
# var menuHeight = document.getElementById(menu).clientHeight; 

You can use jQuery here too:

var windowHeight = $(window).height();
var menuHeight = $(#menu).height();

at line 158 you have the following:

# var liList = $(#lateralPanel li).get();  
# for (var i = 0, item; item = liList[i]; i++) {  
# if(item.innerHTML == $(this).text())  
# item.className = active;  
# else  
# item.className = ;  
# }  

I believe this can be replaced with:

$(#lateralPanel li).removeClass(active);
$(this).addClass(active);

- that will remove the active class from all the list items, then add it to 
the target element that triggered the click event (the function that 
surrounds the snippet above).

Also, you have code in there that handles browser differences.  jQuery handles 
most of this for you.  For instance:

$(#myObj).height(100);  

handles the differences between most browsers.  Which makes your code even 
easier to read.

Otherwise not a bad start.  Keep em coming. :)

Shawn


On Tuesday 21 October 2008 16:03:48 AdrianMG wrote:
 In this tut we will create a professional interface for your web
 applications using the killer javascript library jQuery :)

 I hope you can use it for your personal projects guys. Feedback is
 welcome!

 http://yensdesign.com/2008/10/create-a-professional-interface-for-your-web-
applications-using-jquery/




[jQuery] $(document).ready() vs $(function () {});

2008-10-20 Thread Shawn

I am seeing more and more references to using the $(function() {}); format for 
the ready method.  Is there a compelling reason for this?  Or will 
$(document).ready() perform as well?

Or perhaps I'm mis-understanding what the newer format is being used for?

Thanks for any tips.

Shawn


[jQuery] Re: jquery.ui theme issue (via themeroller)

2008-10-12 Thread Shawn

More info

The dialog works fine, unless it is modal.  The overlay gets a z-index of 
1001.  And seems to always be 1 more than the highest z-index on the page.  
Themeroller does not include any classes for the overlay, so this seems to be 
a conflict between the themeroller classes and the default library based 
styles.  (because Flora works fine with those same styles...)

If it helps any, I'm running FF3 on 64bit Kubuntu.

Shawn

On Sunday 12 October 2008 04:39:36 Shawn wrote:
 I just downloaded a theme from the jquery.ui themeroller
 (http://ui.jquery.com/themeroller).

 When I apply that theme to a dialog with form elements, the form elements
 cannot be clicked on because the z-index is not quite right.

 It seems that ANY theme there runs into this problem  It looks like the
 z-index is somewhat dynamic, so it's not just a quick fix in the css (that
 I can see right this moment).

 Is this a known issue with a known work-around?  Or do I need to start
 hacking away at it?

 Besides this, I like the ThemeRoller very much though it'd be nice if
 the dialog buttons were aligned to the right.  Like real dialogs.. :)  (I
 know... I'm free to change the CSS as needed, but still.. lol)

 Shawn




[jQuery] jquery.ui theme issue (via themeroller)

2008-10-12 Thread Shawn

I just downloaded a theme from the jquery.ui themeroller 
(http://ui.jquery.com/themeroller).  

When I apply that theme to a dialog with form elements, the form elements 
cannot be clicked on because the z-index is not quite right.  

It seems that ANY theme there runs into this problem  It looks like the 
z-index is somewhat dynamic, so it's not just a quick fix in the css (that I 
can see right this moment).  

Is this a known issue with a known work-around?  Or do I need to start hacking 
away at it?

Besides this, I like the ThemeRoller very much though it'd be nice if the 
dialog buttons were aligned to the right.  Like real dialogs.. :)  (I know... 
I'm free to change the CSS as needed, but still.. lol)

Shawn


[jQuery] Escaping the apostrophe

2008-09-17 Thread Shawn Molloy

When I have a string that contains an apostrophe, whats the best way
to handle it?

For example, this function call throws the following error:

Function:
onclick=addQuote('This video don't work!'); return false;

Error:
missing ) after argument list
addQuote('This link don't work!'); return false;

Whats the best way to handle this scenario?

Thanks,

--shawn


[jQuery] Re: How to queue up ajax requests?

2008-07-16 Thread Shawn


partner56290674 wrote:

secondly, i still am confused to why u think jQuery should not offer
this support because you believe this is bad. Remember, the idea of


I think it is inappropriate because you are describing an application 
specific issue.  Not all applications will have the same needs.  The 
requirement is not general enough (IMO) to be made part of the jQuery 
framework.  Your needs and my needs are similar, but still very 
different.  Do you try to handle ALL possibilities in the framework, or 
provide the tools for the developers to solve their own needs?


Additionally, you *could* set up jQuery to monitor the page for change 
requests, but that is just one approach.  Typically web pages are event 
driven, and those events trigger ajax calls if/when needed.  You 
mentioned the autocomplete - this is a great example here.  If a user 
starts typing, do you send an ajax request for EVERY keystroke, or do 
you introduce a slight delay to find when the user has paused in typing, 
and THEN send the ajax request with the changed text?  (note that no 
queue is needed at all)  That is a judgment call needed by the 
application developer.  Most autocomplete solutions introduce the delay, 
but there may be legitimate times when this is not desired.  (simple 
select instead of autocomplete maybe?)


It still comes down to the individual developer knows best what they 
need.  The framework should only provide the generic tools to help the 
developer solve those needs - NOT try to solve all developers needs in 
one package.


But this is all just opinion.  I'll leave those decisions to John Resig 
and the rest of the core developers...


My random thoughts

Shawn


[jQuery] Re: How to queue up ajax requests?

2008-07-15 Thread Shawn


the flooding the server with calls is a non argument.  If you don't 
want to do that, then you need to redesign your server side code to 
accept a single request to give you all the data you need.  One call, 
one response then.  But that's a server issue.  And there are 
performance/modularity issues with that approach (depending on 
scale/volume).  Any other way means the client making multiple requests 
from the server.


As for displaying them as they come back to the user, nope.  Only once 
ALL the requests are completed is the further processing done.  But this 
meets MY specific needs.  I had a situation where I needed 3 distinct 
ajax calls, but needed the results of all 3 before I could render the 
output properly.  My approach handles the possibility of the responses 
not being in order.


As for queueing up ajax requests, doesn't that defeat the purpose of 
an asynchronous environment?  Afterall, the end result of queuing up 
requests is a synchronous routine.  Why not just load another page that 
does everything you need?


Your use of the phrase queue may be accurate, but I think you are 
using it slightly differently than I interpreted it in this case.  But, 
if we cannot clearly define what you are trying to do, then we cannot 
clearly tell you if it's in core jQuery, or in a plugin.. :)


Shawn


partner56290674 wrote:

what your doing there Shawn is still flooding the server with ajax
calls, and displaying them as they come back to the user. What happens
if some requests come back out of order (eg. latency)?

now if u switched it around .. that might be usable...

so there's nothing built in to jQuery? Is anyone else queuing up their
ajax requests?


[jQuery] Re: How to queue up ajax requests?

2008-07-15 Thread Shawn


Your situation is clearer now.  I would think though that the solution 
is a little simpler.  Bear with me as I talk through this, but I haven't 
had the joys of working with google maps like this (yet)...


So, user loads the page.  Then user starts panning around.  Rapidly. 
Instead of trying to show EVERYTHING that every pan would result in, 
wouldn't you only need to show the results from the ending location?  If 
the user managed to pan over 5 screen widths in under a second, don't 
you only care about what would be visible when the panning is stopped? 
(I'm trying not to make any assumptions about your app, but.. :) )


So, if that is the case, maybe a short delay before you trigger the ajax 
routines to get your pins.  Pseudo logic for that might be:


pan start
 - clear old time out value (if any)
 - set new timeout

timeout
 - get pin data for current area
 - render pin data

And then if you set the timeout to something reasonable - maybe 500 ms?, 
 then you end up sending much fewer ajax requests, and dealing with 
fewer pins as well.


If needed, you can still combine this approach with the queue idea. 
But instead of queuing ajax requests, queue the areas that need to be 
retrieved on each pan, and then when the timeout fires pass that data to 
your server side code.


Just a thought... and maybe easier to code than ajax queues.

But I guess the answer you are looking for is no, jQuery does not have 
anything out of the box to do what you want.  Nor should it, in my 
opinion.. :)  There may be a plugin for this sort of thing, but I 
haven't seen one (yet).


Shawn


partner56290674 wrote:

the flooding the server with calls is a non argument.  If you don't
want to do that, then you need to redesign your server side code to
accept a single request to give you all the data you need


Not true .. well at least I don't see it as that. I have no probs with
multiple calls hitting the server at once. If you can't write scalable
code, then that's your bad luck and out of scope of this discussion.

This leads to this quote:

As for queueing up ajax requests, doesn't that defeat the purpose of
an asynchronous environment?  Afterall, the end result of queuing up
requests is a synchronous routine.  Why not just load another page that
does everything you need?


and


But,
if we cannot clearly define what you are trying to do, then we cannot
clearly tell you if it's in core jQuery, or in a plugin.. :)



Also not true .. actually far from it .. and i'll use the example i
want to do, to illustrate this.
I'm doing some Ajax calls with my google maps, so when the map is
panned, an ajax call hits our server to retrieve some data to show ON
the map. Easy. Now, the problem lies when users pan-pan-pan-pan-pan ..
ie. do lots of pans in quick succession. Now having 5, 6 or even 10
hits to our server is not a problem. It gets messy when the browser is
trying to download lots of google map tiles AND then render hundreds
of pins (our results from the ajax) .. especially if all the results
are coming back async. So to help relieve the pressure on the client
side, by having an ajax QUEUE client side, the results will only be
rendered one at a time. By default, the browser will try to hit the
server the with the max number of connections to the same domain (eg.
Internet Explorer is defaulted to 2 connection, prior to IE8 i think).

that's what i'm trying to do and why i believe it's important.

It's also for scenario's with latency issues ... check this vid out
(and ignore the fact that it's about script.aculo.us):
http://www.phppatterns.com/stuff/latency.html

does that make more sence?

-me-


[jQuery] Plugin accessor method?

2008-07-14 Thread Shawn


I've built myself a custom plugin that works nicely, but I have one 
(maybe two) little sticking points


My plugin takes the form like this:

(function ($) {
$.fn.myPlugin = function (options) {
return this.each( function () {
$(this).data(myValue, some_value);
});

function show() {
alert($(this).data(myValue));
}
};

$.fn.myPlugin.getValue = function () {
return $(this).data(myValue);
}
})(jQuery);

I want to the implementing user to be able to ask for the specific value 
with something like $(#myObj).getValue(); - or even 
$(#myObj).myPlugin.getValue();  The getValue() method shown above is 
not working - the this object is wrong.  So, I'm looking for ways to 
accomplish this.


Second, I want to be able to explitly set the value via 
$(#myObj).setValue(new_value);


This set method would need to change the value stored via the .data() 
function, AND call an internal method to display the new value (such as 
the show() method shown above)...


I'm drawing blanks and dead ends in my efforts on these two points.  Any 
suggestions?  (other than calling the .data() function directly - I may 
be changing the storage method)


Thanks in advance.

Shawn


[jQuery] Re: How to queue up ajax requests?

2008-07-14 Thread Shawn


What I did was to build an object that would hold the results of each 
ajax request.  I added on a function that would check when all the 
objects were populated, and then call the routine that would handle all 
the data.


Something like this (note I'm NOT using the ajax_queue plugin):

var ajaxQueue = {
  responses: [],
  checkDone: function() {
//change the check value to match the number of expected responses
if (this.responses.length == 3) {
  finishProcessing(this.responses);
}
  }
}

//and then ajax calls something like this:
$.ajax({
  url: somepage.php,
  success: function (data) {
ajaxQueue.responses.push(data);
ajaxQueue.checkDone();
  }
});

And then the finishProcessing() method does whatever is needed...

This got me past some significant performance issues from synchronous 
ajax calls (one ajax request initiated the next, etc.).  But, I'm sure 
this is only one approach


HTH

Shawn

partner56290674 wrote:

Hi folks,
   can anyone help me with some links to queuing up ajax requests
using jQuery please? I tried using the Ajax Queue plug-in (http://
plugins.jquery.com/project/ajaxqueue) but this wasn't much help
(errors).

is queuing now built into jQuery core?

cheers!

-me-


  1   2   3   >