[jQuery] Problems with Jquery 1.3 and Google web optimizer?

2009-11-08 Thread the_woodsman
Hi,

When migrating to JQ 1.3.2, we seem to have found an issue with our
Google Web Optimizer (GWO) experiments.

there seems to be a race hazard of some kind before GWO redirects to
an alternate page version.

The error is along the lines of document.body does not exist... when
we roll back to JQ 1.2 the error dissapears.

Has anyone else experienced these issues?

Thanks in advance,

Elwood


[jQuery] Re: AJAX - ignore mime type

2009-03-31 Thread the_woodsman

Thanks for your responses guys.

James - I think I'm trying to do the opposite, my ajax call returns
XML, and I want to treat it like plain HTML - but I'll look at your
link and see if it helps, thanks!

Klaus - the API exists already and is used by other client technology,
I don't have free reign to change it...  and I shouldn't have to,
everything works fine when i send XML without the mime type!
I just need to ignore the XML mime type, and everything would be
sorted!!!






On Mar 31, 6:30 am, Klaus Hartl klaus.ha...@googlemail.com wrote:
 I am wondering why the server would not serve html in the first place.

 --Klaus

 On 30 Mrz., 15:37, the_woodsman elwood.ca...@gmail.com wrote:

  Hi,

  My ajax requests return xml, with the corresponding mime type.

  I'm using $.get, as so:

          $.get(
                                                  $(this).attr('href'),
                                                  function(data, textStatus)
                                                  {
                                                          
  $('#requestArea').val(data);
                                                  },
                                                  'html' //type, correct?
                                          );

  $('#requestArea').val(data) sets a text area to say [object
  XMLDocument]

  So it seems my setting the type to html does nothing!

  I've played around with this a bit, including using other ajax methods
  apart from .get(), with the same results.

  Am I missing something here?

  Thanks in advance!


[jQuery] AJAX - ignore mime type

2009-03-30 Thread the_woodsman

Hi,

My ajax requests return xml, with the corresponding mime type.

I'm using $.get, as so:

$.get(
$(this).attr('href'),
function(data, textStatus)
{

$('#requestArea').val(data);
},
'html' //type, correct?
);

$('#requestArea').val(data) sets a text area to say [object
XMLDocument]

So it seems my setting the type to html does nothing!

I've played around with this a bit, including using other ajax methods
apart from .get(), with the same results.

Am I missing something here?

Thanks in advance!



[jQuery] Can I use a selector instead of this fn to check for .jpg?

2009-01-06 Thread the_woodsman

Hi all,

I have a function that determines (a bit hackily!) if an image is a
jpeg.

isJpeg=function(src)
{
mySplit=src.split('.');
extension=mySplit[mySplit.length-1];
isJpg=(extension=='jpg' || extension=='jpeg' || 
extension=='JPG' ||
extension=='JPEG');

return isJpg;
};

I think I might be able to rewrite this as a JQ selector involving the
image's src attributes, something like:
$('img').filter(img[src*!='.jpg'])

But I can't get this to work- and I'm especially unsure how to do the
variations of the extension in an OR clause.

Any tips?

Thanks!


[jQuery] Re: .html() only works on original source?

2009-01-02 Thread the_woodsman

Thanks for that, never done custom events before.

Unfortunately, the whole idea of saving in the $input.data() doesn't
work - I think this is because It's not technically the same DOM
element, it's a new DOM form element,  created from the same markup as
one that had data attachments.

I've attached the info to $(document).data() instead, using the key
formId_inputName.

Thanks for your help!



On Jan 1, 9:30 pm, Ricardo Tomasi ricardob...@gmail.com wrote:
 You could use custom events:

 $('#form').bind('hidden',function(){
    $(this).children(':input').each(function(){
       var t = $(this);
       t.data('value', t.val() );
   });}).bind('visible',function(){

     $(this).children(':input').each(function(){
      var t = $(this);
      t.val( t.data('value') );

 });

 $('#form').hide().trigger('hidden');
 $('#form').show().trigger('visible');

 there is also a plug-in that implements listeners for all of jQuery's
 methods, so you could do something like:

 $('form').bind('hide', function(){ });
 $('form').hide();

 But I couldn't find it. I think Ariel Fresler was involved with it. In
 case he's reading this I bet he would be kind enough to provide you
 with a link :)

 cheers,
 - ricardo

 On Dec 31 2008, 7:43 am, the_woodsman elwood.ca...@gmail.com wrote:

  Thanks Ricardo,
  That's along the lines of what I've been working on, althuogh I didn't
  think to use data() of the actual field, I was putting it in data
  ('field_name') of the form itself - your way is probably nicer!

  I was wondering, instead of the each() loop above, is there an event
  that I could use for when the inputs become visible again?? that way
  the inputs know to repopulate themselves when they're re-shown...

  On Dec 31, 5:05 am, Ricardo Tomasi ricardob...@gmail.com wrote:

   Two issues at play here:

   1. the HTML in most browsers doesn't reflect all recent changes done
   via Javascript
   2. the browser only saves form values after a submit

   What you can do is save the values at the time of removal, and then re-
   fill it when you put it back. Use the data() function:

   // removal, store the values
   var oldform = $('#form').children(':input').each(function(){
      var t = $(this);
      t.data('value', t.val() );

   }).end().remove();

   //append and fill
   oldform.appendTo('body').children(':input').each(function(){
        var t = $(this);
        t.val( t.data('value') );

   });

   - ricardo

   On Dec 30, 1:39 pm, the_woodsman elwood.ca...@gmail.com wrote:

Hi all,

I'm trying to save the content of a form into a hidden div, so I can
bring it back later.

However, I also want to save the user's progress on the form. I
thought I could just dump $('#form').html() into the hidden div, but
this seems to only remember the original html, no new value attributes
exist even after I've entered some text.

I tested with something like this:

                $('body').find(':input').each(

                function()
                {
                        alert($(this).attr('name')+: 
+$(this).val()+, +$(this).attr
('value'));
                        //.val() and .attr(val)  are always up to date
and consistent

                        alert(+$(this).parent().html());
                        //inconsistent with .attr(val)  above, seems to
be the original only

                }
                );

An obvious work around would be to iterate through the inputs
explicitly setting the value atribute to .val(), which I assume would
work, but it seems there must be a more elegant way...

Is there something like  .liveHtml()?  Or another solution?

Thanks in advance...


[jQuery] Re: is it possible to get result of this

2009-01-02 Thread the_woodsman

Well, it all depends how you're intending to save the shirt
customisations in the back end!

Assuming you're saving some list of images for shirts (along with
their positions) in your database, there's no reason this couldn't be
done via ajax.

I'd advise, however, making this save in a traditional full page load
for now - it's not usually that difficult to ajaxify something
that's already working, and will make the task at hand a lot clearer
and more focussed.



On Jan 2, 11:36 am, merihsaka...@yahoo.com merihsaka...@yahoo.com
wrote:
 Hi
 I am trying to do something with Jquery and Ajax
 But I am not sure that its possible or not.
 its my example, you can see what I am trying to 
 do.http://www.unikhas.org/design/index.jsp
 I want to save all the things after I desing my tshirt.
 Is it possible to do that in Jquery or Ajax ?
 or should I use other technologies?

 thank you very much..


[jQuery] Re: .html() only works on original source?

2008-12-31 Thread the_woodsman

Thanks Ricardo,
That's along the lines of what I've been working on, althuogh I didn't
think to use data() of the actual field, I was putting it in data
('field_name') of the form itself - your way is probably nicer!

I was wondering, instead of the each() loop above, is there an event
that I could use for when the inputs become visible again?? that way
the inputs know to repopulate themselves when they're re-shown...

On Dec 31, 5:05 am, Ricardo Tomasi ricardob...@gmail.com wrote:
 Two issues at play here:

 1. the HTML in most browsers doesn't reflect all recent changes done
 via Javascript
 2. the browser only saves form values after a submit

 What you can do is save the values at the time of removal, and then re-
 fill it when you put it back. Use the data() function:

 // removal, store the values
 var oldform = $('#form').children(':input').each(function(){
    var t = $(this);
    t.data('value', t.val() );

 }).end().remove();

 //append and fill
 oldform.appendTo('body').children(':input').each(function(){
      var t = $(this);
      t.val( t.data('value') );

 });

 - ricardo

 On Dec 30, 1:39 pm, the_woodsman elwood.ca...@gmail.com wrote:

  Hi all,

  I'm trying to save the content of a form into a hidden div, so I can
  bring it back later.

  However, I also want to save the user's progress on the form. I
  thought I could just dump $('#form').html() into the hidden div, but
  this seems to only remember the original html, no new value attributes
  exist even after I've entered some text.

  I tested with something like this:

                  $('body').find(':input').each(

                  function()
                  {
                          alert($(this).attr('name')+: +$(this).val()+, 
  +$(this).attr
  ('value'));
                          //.val() and .attr(val)  are always up to date
  and consistent

                          alert(+$(this).parent().html());
                          //inconsistent with .attr(val)  above, seems to
  be the original only

                  }
                  );

  An obvious work around would be to iterate through the inputs
  explicitly setting the value atribute to .val(), which I assume would
  work, but it seems there must be a more elegant way...

  Is there something like  .liveHtml()?  Or another solution?

  Thanks in advance...


[jQuery] .html() only works on original source?

2008-12-30 Thread the_woodsman

Hi all,

I'm trying to save the content of a form into a hidden div, so I can
bring it back later.

However, I also want to save the user's progress on the form. I
thought I could just dump $('#form').html() into the hidden div, but
this seems to only remember the original html, no new value attributes
exist even after I've entered some text.

I tested with something like this:

$('body').find(':input').each(

function()
{
alert($(this).attr('name')+: +$(this).val()+, 
+$(this).attr
('value'));
//.val() and .attr(val)  are always up to date
and consistent

alert(+$(this).parent().html());
//inconsistent with .attr(val)  above, seems to
be the original only

}
);

An obvious work around would be to iterate through the inputs
explicitly setting the value atribute to .val(), which I assume would
work, but it seems there must be a more elegant way...

Is there something like  .liveHtml()?  Or another solution?

Thanks in advance...


[jQuery] Problems using $.load() on remote contentw ith a large dropdown (select)

2008-11-19 Thread the_woodsman

Hi all,

I have a html page with a massive (200+ options) drop down:

select name=data[Something][country_id] id=someID
option value=1United Kingdom/option
option value=39Afghanistan/option
option value=40Aland Islands/option
 etc etc!

By itself, this paeg loads fine.
When I try to ajax load it using .load, the select box doesn't render
properly in any browser - IE gives an empty select, and dumps the
countries beneath it, Chrome has an empty select and no sign of the
countries.

Firefox displays an empty select with the countries beneath, but the
countries are formatted as if they were in a select!

My first thought was that it's invalid markup, but I can't find
anyhting, and as I said it renders fine if you call the page directly
and not via AJAX.

Anyone seen anything like this before?

Thanks in advance...


[jQuery] Best event for changing the content of a div?

2008-11-05 Thread the_woodsman

Hi,

I want to change the content of a div asap.

I know about document.ready, but if possible I'd rather do this
earlier. I'd also rather do it as an event instead of loading a script
file after the div appears in the page.

I tried the load() event, but this didn't seem to fire at all.

Anyone got any tips on this?


[jQuery] Using JQ to parse strings (IE?)

2008-10-30 Thread the_woodsman

Hi,
I hope someone has some tips/advice on this one!

I've noticed my code has an issue in IE.

I try to apply JQ to a string, as so:

$(htmlString).find(someSelector)   //htmlString is basically an entire
page, someSelector is an ID

But IE never finds the elements, even though FF does. I assume putting
strings into $() isn't the best practice?

I then tried to inject the htmlString directly into the DOM, so I
could definitely parse it with JQ once it was part of the page, but
this was even worse: scripts started to reload etc, real bad stuff.

Has anyone come across this before? Is there an easy way to do this in
IE that I'm missing?

Thanks in advance :)



[jQuery] Re: requesting and sending JSON in a ruby on rails app

2008-05-07 Thread the_woodsman

Well, I don't use RoR or treeview, so my advice is more general...

  jQuery(#prop-tree).treeview({
url: tree/self_and_children
  });

a) No idea what this actually achieves, but I think the goal is to set
the content type header.
 Using Firefox (with Firebug/Developer Extensions) you can check if
the content type header is set correctly.

Also, using firebug, you can look at the result sent back via Ajax,
and paste it into the console to see if it's valid JSON/javascript.

Hope that helps...




On May 7, 2:05 pm, Max Williams (Brighton)
[EMAIL PROTECTED] wrote:
 Hi - first of all this is a plugin-specific question (about treeview)
 - i sent it to the plugin discussion page but it seems pretty dead (no
 posts for over a year), so i'm sending it here as well.  If anyone
 could help me out that would be fantastic.

 I've been using treeview and have no problems with it so far.
 However, to get better performance i'm now trying to switch to the
 asynchronous version:http://jquery.bassistance.de/treeview/demo/async.html

 In the example they use php to return some json to the tree, but i'm
 using it in a ruby on rails app, and can;t work out how to get it to
 work.  Can anyone help?  I'm really just not sure how to get the
 required json for the update back to the treeview.

 This is what i'm doing at the moment:

 In the view:

 jQuery(document).ready(function(){
   jQuery(#prop-tree).treeview({
 url: tree/self_and_children
   });
 });

 ...
   ul id=prop-tree
   /ul

 The url tree/self_and_children does seem to be calling the correct
 controller and action, which is as follows:

  def self_and_children
 # expects the id of the branch which is clicked on, which will be
 something like
 # property_id_79.  We want property with id 79.
 if params[:id]
   property = Property.find(params[:id].split(_).last)
 else
   property = Property.root
 end

 @json = property.self_and_children_to_json
 respond_to do |format|
   if @json
 #should never get an html request for this
 format.html { render :text = @json }
 format.xml  { head :ok }
 format.js { render :text = @json }
   else
 format.html { }
 format.xml  { render :xml = @json.errors, :status
 = :unprocessable_entity }
 format.js
   end
 end
   end

 But, nothing comes back - at least, the tree doesn't change.  My
 questions are as follows:

 a) is doing render :text = @json the proper way to send back the
 chunk of json to treeview?  Should i do something in a js.rjs file
 instead?
 b) how do i send through the id of the clicked-on branch to the
 controller? (and retrieve it in the controller)

 thanks in advance
 max


[jQuery] Re: Simple Ajax calls to server for data

2008-05-04 Thread the_woodsman

If your AJAX call returns JSON, you might be better off using the JSON
specific ajax methods.

If you're new to JQ and JS, do you use Firebug in Firefox? With that
tool, you can more easily check what's being returned from your ajax
call etc.


On May 4, 9:18 pm, dineshv [EMAIL PROTECTED] wrote:
 First, I'm very new to JS/JQ.  I've got a simple HTML list of items
 that I want updated from the server whenever the user requests it (by
 hitting a submit button).  The results from the (Python/webpy) server
 are held in a list result[].  Here is the html:

 div id=results
 p$result[0]/p
 p class=alt$result[1]/p
 p$result[2]/p
 p class=alt$result[3]/p
 p$result[4]/p
 /div

 This is what I have so far:

 $.get(/ac, function(data) {
 $(result, data).each(function(result_number) {
 var result_text = $(result, data).get(result_number);
 $(#results).append(p.$(result_text).text()./p);
 });

 });

 Which doesn't work!  I'd like to return the results in JSON format for
 performance.  I know this is very simple to do and all help
 appreciated.

 Dinesh


[jQuery] Re: Problems with jqm in IE

2008-05-01 Thread the_woodsman

*bump* :)

Any ideas? Thanks!

On Apr 29, 10:49 pm, the_woodsman [EMAIL PROTECTED] wrote:
 Hi guys,

 After some laborious use of alerts, I've tracked down my bug in IE,
 and it relates to $().jqm().

 I think It's a live query style issue (I'm not actually using live
 query!).

 I have a function that attaches events to elements, and this is called
 again when new elements are added via AJAX.

 I have the following code:

 attachEvents: function()
 {
   // do stuff...

 if(!$('#dialog').jqm)
 {
 alert('jqm fn does not exist!!');
 }

 /* make modal popup from #dialog */
 $('#dialog').jqm(
 // ... blah blah blah

 So, the attachEvents function gets called multiple times.
 In FF, everything is fine.

 In IE, the second time you call attachEvents, $('#dialog') still
 alerts as an object, but it doesn't have a .jqm() method!
 Unsurprisingly, the error is Object doesn't support this property or
 method.

 Any suggestions?? I'm pretty stumped :|


[jQuery] Re: Way to designate links as form submitters?

2008-05-01 Thread the_woodsman

Hey,

THis shouldn't be tricky, as long as you cna easily find which form
you want to submit!

Are there multiple forms on the page to choose between?

Something like this *should* submit the first form on the page
(untested) ...

$('.submitLink')
.click(

function()
{
$('form').get(0).submit();
return false;
}

);

On May 1, 5:32 pm, Rick Faircloth [EMAIL PROTECTED] wrote:
 As a follow-up to my question, I found this method
 that utilizes regular JS, but I'd like to be able to
 cause any link with a certain id to act as a Submit Link.

 Here's the code I found to create a text submit link:

 script language=JavaScript type=text/javascript
 !--
 function getsupport ( selectedtype )
 {
   document.supportform.supporttype.value = selectedtype ;
   document.supportform.submit() ;}

 --
 /script

 form name=supportform method=post action=yourscriptname.cgi

 input type=hidden name=supporttype /
 a href=javascript:getsupport('Paid')Paid Support/a or
 a href=javascript:getsupport('Free')Free Support/a

 Thanks for any help in changing this to jQuery!

 Rick

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
  Rick Faircloth
  Sent: Thursday, May 01, 2008 12:08 PM
  To: jquery-en@googlegroups.com
  Subject: [jQuery] Way to designate links as form submitters?

  Anyway to do that?

  Have certain links, say with an id of link,
  to be programmed to submit a form when clicked?

  Rick


[jQuery] Problems with jqm in IE

2008-04-29 Thread the_woodsman

Hi guys,

After some laborious use of alerts, I've tracked down my bug in IE,
and it relates to $().jqm().

I think It's a live query style issue (I'm not actually using live
query!).

I have a function that attaches events to elements, and this is called
again when new elements are added via AJAX.

I have the following code:

attachEvents: function()
{
  // do stuff...

if(!$('#dialog').jqm)
{
alert('jqm fn does not exist!!');
}


/* make modal popup from #dialog */
$('#dialog').jqm(
// ... blah blah blah



So, the attachEvents function gets called multiple times.
In FF, everything is fine.

In IE, the second time you call attachEvents, $('#dialog') still
alerts as an object, but it doesn't have a .jqm() method!
Unsurprisingly, the error is Object doesn't support this property or
method.

Any suggestions?? I'm pretty stumped :|



[jQuery] Re: Drag and Drop question

2008-04-06 Thread the_woodsman

Do you have firefox and firebug?

Just run console.log(ui)  to dump all the fields and methods of the
object to the firebug console... should be a useful place to start!



On Apr 5, 8:08 pm, chris [EMAIL PROTECTED] wrote:
 I am still having problems with this. I can't find anything on the web
 about inspecting the arguments.

 Help :)

 On Apr 4, 1:45 pm, chris [EMAIL PROTECTED] wrote:

  I am trying to allow a person to sort a list of items by dragging and
  dropping them.  I need to know the new index to where the item was
  dropped into.  I would imagine that value is contained in the ui
  argument that is handled by the drop callback.
  ...
  drop: function(ev, ui) {
  // act on the drop event

  }

  Is there a place or a method to find out what is contained within the
  ui arg?

  Thanks for the help.


[jQuery] Re: jQuery in IE7

2008-03-31 Thread the_woodsman

I'm no expert, and you don't provide any information about the errors
in IE.

Random guess:

 $(document).ready(

Have you tried quoting document, i.e $('document')?

On Mar 30, 7:27 pm, Tolik Piskov [EMAIL PROTECTED] wrote:
 Hello!

 I was trying to start learning jQuery, but faced a problem: ready
 event doesn't work in IE7, but works fine in Firefox and Safari.

 ...
 script type=text/javascript src=./jquery-1.2.2.js/script
 script type=text/javascript
$(document).ready( function() {
   alert ( test );});

 ...

 I tried different versions: 1.2.2,1.2.3, regular, packed, minified. I
 guess this is a bug.


[jQuery] Re: Accessing Parent Classes variables from $.Post function

2008-03-27 Thread the_woodsman

Can you not just make a new reference before the ajax call?

DB_info.prototype.get_column_details = function(obj, table, column) {

someRef=this; //or DB_info.prototype, or whatever you prefer

   $.post(this.db_info_script,
 {   action: get_column_details,
 table:  table,
 column: column},
 function(json) {

// Watch out, here comes the tricky part
someRef.results = json;
 },
 json);

 return true;

 }

 The tricky part, or the part I'm having trouble with, is how to set
 DB_info.results = to the json results of the $.post call.  I realize
 that the problem at the tricky part is that this at that point is
 refering to the jQuery object, but DB_info.results and
 DB_info.prototype.results don't seem to work either.

 Is there anyway I can pass something through the $.post callback so
 that my ajaxComplete listeners can get to that json object?  Or is
 there an obvious better way to do be doing all this in the first
 place.

 Again, thanks all for reading!


[jQuery] Re: Set src of image in containing div of this div ?

2008-03-26 Thread the_woodsman

 $(this).parent().parent('.display img').attr('src', val);

I think with a bit mroe debugging you can crack this - one thing that
looks suspect is parent().parent('.display img'), surely nothing's
going to have an image as a parent? I would assume you're looking for
something more like parent().parent('.display').find('img'), or
similar.

If I were you I'd break it into smaller chunks and use Firebug to see
what dom elements get returned by different calls to parent/parents.






On Mar 25, 8:36 pm, elspiko [EMAIL PROTECTED] wrote:
 Hi,

 I'm fairly new to jQuery so bare with me. I've had a search on the forums,
 but if its already been answered i apologise

 I'll show the code first...easier to explain

 div class=product
 div class=display images/bedroom.jpg /divbr /
 div class=thumbs images/thumbs/bedroom.jpg  images/thumbs/bedroom1.jpg
 images/thumbs/bedroom2.jpg /div
 /div

 div class=product
 div class=display images/tables.jpg /divbr /
 div class=thumbs images/thumbs/tables.jpg  images/thumbs/tables1.jpg
 images/thumbs/tables2.jpg /div
 /div

 Multiple product classes, when you click on one of the thumbnails, the img
 in the display class updatesor rather it should. When a thumbnail is
 clicked the images in all of the display classes change to the selected
 image rather than just the display class in the containing div.

 I know its because I need to select display class in the current selected
 product but i don't know how...

 I've tried variations on the theme of

 $(this).parent().parent('.display img').attr('src', val);
 $(this).parents...
 etc etc

 Below is the current code (where all the images display the same)

 $(document).ready(function() {
   $('.thumbs img').click(function() {
 var scr = $(this).attr('src').replace(thumbs/,);
 $('.display img').attr(src, scr);
   });

 });

 But I'm just stumped. Please help, I hope I've made myself as clear as
 possible, if not i apologise

 --
 View this message in 
 context:http://www.nabble.com/Set-src-of-image-in-containing-div-of-this-div-...
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Re: form+ajax

2008-03-09 Thread the_woodsman

I think we can.

Look at the ajax form plugin (http://www.malsup.com/jquery/form/),
which can seamlessly convert your forms to ajax and  give you the
resulting page.

Then, you just have to put these into your div, using .html() or
somesuch.

On Mar 8, 12:42 pm, mauro [EMAIL PROTECTED] wrote:
 I have a simple form followed by a div:

   form id=form method=post action=search.cgi
   ul id=formFields
 liinput id=word name=word class=field text medium
 type=text maxlength=255 value=//li
 liinput type=submit value=Search //li
   /ul
   /form
   div id=results/div

 when I submit the form I would like to display the search.gci page
 inside the results div
 I'm not able to modify the action performed... can you please help a
 novice?

 Mauro


[jQuery] Re: toggle() animation - maybe there is a neater way to do this?

2008-03-08 Thread the_woodsman

Have you looked at JQ's built in toggle event?
You won't have to keep track of even/odd clicks at all if you use
that...


On Mar 8, 8:53 am, Karl Swedberg [EMAIL PROTECTED] wrote:
 Not sure if this is neater, but it does have fewer lines of code:

 var stoggle = false;
 $(#button).click(function(){
 var extra = 150, divTop = parseInt($('#div').css('top'));
 $('#div').animate({top: !stoggle ? divTop + extra : divTop - extra},
 400);
 stoggle = !stoggle;

 });

 --Karl
 _
 Karl Swedbergwww.englishrules.comwww.learningjquery.com

 On Mar 7, 2008, at 7:26 PM, jquertil wrote:



  I have this code shown below - it works fine but I imagine there is a
  neater way to accomplish this... anyone?

  I would love to somehow shrink this to less lines of code.

  stoggle = 0;
  $(#button).).click(function(){
 var extra = 150;
 if(stoggle==0){
 
  $('#div').animate({top:parseInt($('#div').css('top'))+extra},400);
 stoggle = 1;
 }else{
 
  $('#div').animate({top:parseInt($('#div').css('top'))-extra},400);
 stoggle = 0;
 }
  });


[jQuery] Re: ajax/jquery

2008-03-08 Thread the_woodsman

Well, you'll have to make all your forms work traditionally, and use
JQ to override them, using things like the ajax form plugin etc.

Similiarly, any UI widgets you use should build themselves from
existing markup on the page.

For very complicated interfaces, it might be easier to provide a pure,
accessible html solution, and a seperate JQ one that you redirect to
with javascript...



On Mar 6, 3:42 pm, raj-gorsia [EMAIL PROTECTED] wrote:
 Hey guys,

 Basically, i just wanted some advise on a project that i am working on
 for a big client of mine.
 Ive got a folder full of notes regards to accessibilty and how to make
 the website fully compliant.
 The problem is, that we decided to use ajax/jQuery to provide alot of
 the functionality on the website, but i am still searching around if
 ajax would be the way forward if the client is wanting a 100%
 accessible website.

 Nothing from me has been coded yet, and its just ideas that i am
 researching on at the moment, which ajax was mentioned.

 My question is that, is there a backup plan if i did code the website
 using ajax using jquery but if js was disabled then how would it
 function. i.e. rather then the ajax call passing data into a div, the
 page would reload and take the action it needs to.

 Hope that makes sense and any advise/tips and tricks would be
 greatful.

 Thanks

 Raj


[jQuery] Re: calling a php function with jquery

2008-03-05 Thread the_woodsman

Erm, there's a few hurdles in front of you...

In short, you have to:
- make a URL that runs the php script- this should work via your
browser (helloscript.php?user=bob, perhaps),
-  call this URL via ajax, and insert the output into the current
page.


On Mar 5, 5:18 pm, everdream [EMAIL PROTECTED] wrote:
 Hello !
 I have a php function : helloUser in the file : myFunctions.php.
 This is my function :

 ...
 function helloUser($user)
 {
   return Welcome $user !;}

 ...

 I'm using jquery for an application but i don't know how to call a php
 function and give parameter (here :$user) and recover the result (here :
 welcome ...).

 Can somebody help me?

 Thanks a lot.

 --
 View this message in 
 context:http://www.nabble.com/calling-a-php-function-with-jquery-tp15853808s2...
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Re: Using jQuery without ready()

2008-03-03 Thread the_woodsman

To my knowledge, the main motivation for using ready and similar is
that otherwise, you have to pay close attention to where your scripts
are included in your page to ensure everything that the script relies
on has already been added to that page.
For example, if your script affects all .someClass elements, but not
all of them have been added to the document before your script file
was included, then the ones that came after the script block/include
will be missed out.

On Mar 2, 9:21 pm, fetis [EMAIL PROTECTED] wrote:
 Hi, all.
 I often use jQuery outside ready() function. Like this

 div id=asome html/div
 script
  $(#a).some actions
 /script

 Have this way some hidden troubles or it's ok such using?


[jQuery] Overriding form submissions in a way that deals with this.form.submit()

2008-01-31 Thread the_woodsman

Hi everyone,

I'm using Jquery to override form submits, i.e:

var tabsForms=$('#'+el.id+' form');
tabsForms.submit(function(){...

Pressing submit works fine with this approach, but there's existing
code in the form inputs, such as onclick=this.form.submit.

When the form is submitted this way, it seems that the submit() event
I created via JQuery is ignored, and the form submits normally.

I can't change the zillion examples of this in my existing pages - so
how can I make this.form.submit() submit just like pressing the submit
button now does?

Thanks in advance!



[jQuery] Re: Is this the best way?

2008-01-31 Thread the_woodsman

Assuming that the level starts at 0,
I think you could apply successive not filters to the Jquery
selection, the first eliminating level=0, the second eliminiating
level=1, etc...

On Jan 31, 3:46 am, Danny [EMAIL PROTECTED] wrote:
 jQuery does not have a built-in selector to compare the values of
 attributes, but it allows you to write custom filters (analogous to
 plugins). I once found documentation on this but can't anymore. You
 sort of have to read the source to learn to do this.
 You just extend the $.expr[':'] object with your new filter set to a
 string that is evaluated, where 'a' is the element being tested and
 'm[3]' is the argument to the filter:

 $.expr[':'].levelGreaterThan = '$.attr(a,level)m[3]' ;

 Now you can use this anywhere:

 $('qualif:levelGreaterThan(3)').remove();

 Far more bizarre but potentially useful would be a custom filter that
 tests any attribute:

   $.expr[':'].attr = 'eval(m[3].replace(/^(\\w+)/,$.attr(a,\\$1\
 \)))';

 and now write:

 $('.qualif:attr(level3)').remove();

 Unfortunately the parser for [attr] is not extensible, so you
 can't create a [level3] selector directly

 Danny
 On Jan 30, 12:22 pm, Feijó [EMAIL PROTECTED] wrote:

  Hi Cabbite

  Thanks for your 0.02

  Its possible to simple use like this?
  $('.qualif[level3]').remove();

  if level bigger then 3, remove it :)

  My code is dynamic, I cant just wrote all numbers I dont need to remove,
  like your example.  Has to use a condition.

  Feijó

  cabbiepete escreveu:

Hi Felix,

I would have thought doing an attribute selector like you suggest was
better.

something like

... $('.qualif[level]).each  ...

to at least get rid of anything that doesn't have the level
attribute. Also if you use the same tag name for all of these
attributes its worth adding that as it also helps with efficiency,
i.e. jquery only has to check those tags for level attribute.

Depending on the exact use of the level attribute you might be able
to get just the ones you want by using [attribute!=value] selectors.
i.e. if you want greater than 4 and start at 0

$('.qualif[level!=0], .qualif[level!=1], .qualif[level! =2],
.qualif[level!=3], qualif[level!=4]').remove();

Hope that helps. Also if any more expert on jquery knows more am keen
to know better also.

Cheers, Pete

On Jan 30, 12:56 pm, Feijó [EMAIL PROTECTED] wrote:
Hi, I was just wondering if there is any better way to accomplish
that. Some divs has 'level' attribute, with a number.  If that
number is bigger than X, will remove the div. var x=4; //
simulating level=parseFloat($this.attr('level'));
$('.qualif').each(function() { if ($(this).attr('level')x)
$(this).remove(); }); I don't know if we can set a filter in $('')
to look at a custom attribute, should be simpler than Feijó


[jQuery] Re: Accessing jQuery functions from outside

2008-01-31 Thread the_woodsman

Have you tried putting the fn outside of document ready, and then
calling it in both document ready and the onclick?

Btw, you don't put the javascript: in an onclick, only in a href,
that might cause problems too...

On Jan 31, 1:44 pm, wyo [EMAIL PROTECTED] wrote:
 I've some functions which I'd like to use outside of jQeury in normal
 HTML, e.g.

   script type=text/javascript
 $(document).ready(function() {

   function collapse (i) {
 $('#expanded_'+i).hide();
   }
 });
   /script

 ...

   img src=images/plus01.png onclick=javascript: collapse (17)
   div id=#expanded_17.../div

 What do I have to write at the onclick?