[jQuery] Re: jQuery and JSON - newbie!

2008-05-02 Thread Dave Probert

Glad I could help :)

Cheers,
Dave

On May 2, 6:35 pm, eid <[EMAIL PROTECTED]> wrote:
> Hi Dave,
>
> it worked great with a little bit of modification.
>
> Thank you very, very much! And I even learned something new today
> then :)
>
> Thanks again
> eid
>
> Dave Probert wrote:
> > Hi eid,
>
> > I've taken a look at what you are trying to do and I think there are
> > two aspects that need to be 'corrected'.
>
> > 1.) In the JSON, there is no need for an array of items  - remove the
> > [ & ] after 'items'.  items is then an object with elements called
> > 'lanceOfMitraDivinity', 'wrathOfMitraDivinity', etc.  Much easier to
> > handle.
>
> > 2.) To setup the buttons you would be better like this (not the only
> > way to do it, but this works!):
> > $.getJSON('featsCalculator/priestofmitra.js', function(data)
> > {
> >   $('.featButton').click(function()
> >   {
> >   var t = $(this).attr('id');
> > if(data.items[t])
> > {
> >   $('#state').html(data.items[t].description.base);
> > }
> >   });
> > });
>
> > You can use the items part of the json like an array, even though it
> > is an object - because all objects can be accessed either via the dot
> > operator (.) or using square brackets ([]).
>
> > Here is some tested code that works with the modified json you
> > provided.  Just cut and paste (modify any filenames and paths) and try
> > it.
>
> > - start of code
>
> > 
> > 
> >   $(document).ready(function()
> >   {
> > $.getJSON('featsCalculator/priestofmitra.js', function(data)
> > {
> >   $('.featButton').click(function()
> >   {
> >   var t = $(this).attr('id');
> > if(data.items[t])
> > {
> >   $('#state').html(data.items[t].description.base);
> > }
> >   });
> > });
> >   });
> > 
> > 
> > Lanc
> > Pier
> > Cond
>
> > - end of code
>
> > Hope that helps a bit.
>
> > Cheers,
> > Dave


[jQuery] Re: jQuery and JSON - newbie!

2008-05-02 Thread Dave Probert

Hi eid,

I've taken a look at what you are trying to do and I think there are
two aspects that need to be 'corrected'.

1.) In the JSON, there is no need for an array of items  - remove the
[ & ] after 'items'.  items is then an object with elements called
'lanceOfMitraDivinity', 'wrathOfMitraDivinity', etc.  Much easier to
handle.

2.) To setup the buttons you would be better like this (not the only
way to do it, but this works!):
$.getJSON('featsCalculator/priestofmitra.js', function(data)
{
  $('.featButton').click(function()
  {
  var t = $(this).attr('id');
if(data.items[t])
{
  $('#state').html(data.items[t].description.base);
}
  });
});

You can use the items part of the json like an array, even though it
is an object - because all objects can be accessed either via the dot
operator (.) or using square brackets ([]).

Here is some tested code that works with the modified json you
provided.  Just cut and paste (modify any filenames and paths) and try
it.

- start of code



  $(document).ready(function()
  {
$.getJSON('featsCalculator/priestofmitra.js', function(data)
{
  $('.featButton').click(function()
  {
  var t = $(this).attr('id');
if(data.items[t])
{
  $('#state').html(data.items[t].description.base);
}
  });
});
  });


Lanc
Pier
Cond

- end of code

Hope that helps a bit.

Cheers,
Dave

On May 1, 5:03 pm, eid <[EMAIL PROTECTED]> wrote:
> Okay I tried to do what you said.
>
> This is my JSON file:http://pastebin.com/m616d0550
>
> and this is my js file:
> $(document).ready(function() {
> $.getJSON('featsCalculator/priestofmitra.js', function(data) {
> $('.featButton').hover(function() {
> if(data.items.jsname == $(this).attr('id')) {
> alert(data.items.jsname);
> }
> });
> });
>
> });
>
> Nothing happens when I hover a .featButton. What's wrong?


[jQuery] Re: Adobe AIR v1.0 and jQuery Ajax calls

2008-03-02 Thread Dave Probert

Hi Guys (again!),

Tracked down the 'permission denied' part - I forgot to set the
'sandboxRoot' in the iframe to 'http://localhost/'.  That stopped the
error message, but now I get nothing!  Nothing at all - no errors, no
div content change, nothing.

I tested that jQuery is actually working by adding a second div change
to the same function with the ajax call, and that works perfectly.  I
also changed the ajax call to a $('#fff').load('http://localhost/
airtest.php') - this didn't do anything either!  I'm really lost as to
how we can get jQuery ajax to work with AIR.

Still need help.

Cheers,
Dave


[jQuery] Re: Adobe AIR v1.0 and jQuery Ajax calls

2008-03-02 Thread Dave Probert

Hi Guys,

I've just installed Aptana with the AIR plugin.  Nice program - better
than when I previously tried it.

The generated AIR project test file works fine as an AIR app, but
modifying it just slightly to have jQuery.1.2.3 used and adding this
code (below) to the auto-created 'forApplicationSandbox' js function
(removing what was there) in the SampleUI.html file (along with a div
id'd as 'foo' and the appropriate airtest.php (which just prints a
text message - nothing else!)) - then I get a 'permission denied'
error.  I also removed the 'alert' in the main.html caller button - in
case you were wondering! :)

$.ajax({
 url: 'http://localhost/airtest.php',
 success: function(d) { $('#foo').html(d); }
})

Got any ideas why this might be happening?

This is about the simplest use of jQuery Ajax I can think of, as
opposed to the use of 'get or 'load' !!  I'd prefer not to be using
either of the latter two functions as the web app I'm converting has
many instances of $.ajax calls.

BTW, I am a very experienced PHP programmer (it's my main job!) with a
reasonable knowledge of jQuery and Javascript.

Cheers for any help,
Dave

On Mar 2, 10:20 pm, "Mike Alsup" <[EMAIL PROTECTED]> wrote:
> >  Might be a good time for Rey or someone to do a simple tutorial
> >  page ;)  (I would do one - if I could get it to work!)
>
> Here's a trivial example:
>
> 
> 
> 
> 
> 
> 
> $(function() {
> $('body').one('click',function() {
> $.get('http://malsup.com/jquery/form/dummy.php', function(r) {
> $('#main').html(r);
> });
> });
>
> $('button').click(function() {
> window.nativeWindow.close();
> });});
>
> 
> body { background: #ffd }
> 
> 
> Hello World Close
> 
> 
> 


[jQuery] Re: Adobe AIR v1.0 and jQuery Ajax calls

2008-03-02 Thread Dave Probert

Thanks Salvatore,

I'll give Aptana another try - though I'm much more of a straight text
editor user (and I have many macro's already defined for UltraEdit
which is what I use mostly).

For the general user though, a plain text tutorial (with no extra
downloads required - apart from AIR/sdk and jQuery) would be useful.
This allows people to get more of an understanding of the low-level
requirements of the code I think.

Thanks again - and I'll leave a comment here with any findings I get
from using Aptana.

Cheers,
Dave

On Mar 2, 5:15 pm, "Salvatore FUSTO" <[EMAIL PROTECTED]> wrote:
> If you use aptana and it's air plugin, it can directly include the jquery
> library when compling the project; if you define a simple app with an
> application sandbox , an ajax call $("#myDiv").load(myUrl) invoked by
> $(document).ready() should work.
> salvatore
>
> - Original Message -
> From: "Dave Probert" <[EMAIL PROTECTED]>
> To: "jQuery (English)" 
> Sent: Sunday, March 02, 2008 8:24 AM
> Subject: [jQuery] Adobe AIR v1.0 and jQuery Ajax calls
>
> > Hi All,
>
> > Has anyone done any work with the release version 1.0 of AIR and
> > jQuery - specifically using the jQuery Ajax call (in a sandbox page) ?
>
> > I've tried it myself in many ways, but just can't seem to get it to
> > actually get the data.  The page I have done works perfectly in the
> > browser, and the only bit that seems to fail is the $.ajax() call (or
> > it's 'success' callback - not sure which).
>
> > The latest 1.2.3 release of jQuery states that it is now compatible
> > with AIR, but to what extent?
>
> > All the Adobe docs and other tutorial/information sites about AIR use
> > various libraries (Spry, Ext, etc) for their Ajax bits, but I've seen
> > no examples with our favourite - jQuery).
>
> > Might be a good time for Rey or someone to do a simple tutorial
> > page ;)  (I would do one - if I could get it to work!)
>
> > Cheers,
> > Dave
>
> > __ Informazione NOD32 2913 (20080301) __
>
> > Questo messaggio  รจ stato controllato dal Sistema Antivirus NOD32
> >http://www.nod32.it


[jQuery] Adobe AIR v1.0 and jQuery Ajax calls

2008-03-01 Thread Dave Probert

Hi All,

Has anyone done any work with the release version 1.0 of AIR and
jQuery - specifically using the jQuery Ajax call (in a sandbox page) ?

I've tried it myself in many ways, but just can't seem to get it to
actually get the data.  The page I have done works perfectly in the
browser, and the only bit that seems to fail is the $.ajax() call (or
it's 'success' callback - not sure which).

The latest 1.2.3 release of jQuery states that it is now compatible
with AIR, but to what extent?

All the Adobe docs and other tutorial/information sites about AIR use
various libraries (Spry, Ext, etc) for their Ajax bits, but I've seen
no examples with our favourite - jQuery).

Might be a good time for Rey or someone to do a simple tutorial
page ;)  (I would do one - if I could get it to work!)

Cheers,
Dave


[jQuery] New Plugin Pages

2007-07-31 Thread Dave Probert

Any chance you lovely developers of the new plugin site could either:
  Fix the 'Browse by Date'
or
  Remove 'Browse by Date' as an option.
as it doesn't work.

Please.



[jQuery] Re: Anything similar to IE's table.moveRow in jquery?

2007-07-31 Thread Dave Probert

Or for more detailed movement:
  $('tr:eq(3)').insertBefore('tr:eq(1)');
or
  $('tr:eq(2)').insertAfter('tr:eq(5)');
Note: the numbers are the row count - beginning at 0 (zero) for the
first row.

Lookup the jquery :xxx qualifiers for more options.

On Jul 31, 4:16 am, Mike Miller <[EMAIL PROTECTED]> wrote:
> Haven't been able to find any documentation so far that talks about
> how to move rows around with jquery.  Don't really need to sort the
> whole table...rather I want to move one row to another position.  Can
> this be done?



[jQuery] Re: Multiple Interface Resizables

2007-07-18 Thread Dave Probert

Assuming you mean the Interface resizables, there is no way yo do so
without recoding the library.  It hardcodes the ID's for the resize
blobs  - this is Very Bad.

The only way I could get around this was to add or remove the resize
blobs when I click (and/or choose to edit) on an item.  But this is a
bit messy.

Someone needs to write a new resizable plugin that has some extra
(documented!) functions - like add_resize_blobs(),
remove_resize_blobs() and some other stuff!! :)

Apart from that problem it's not a bad plugin :)

Cheers.

On Jul 18, 12:35 pm, jn <[EMAIL PROTECTED]> wrote:
> I've tried everything I can to get the handles to work for multiple
> resizables, but it just won't work.
>
> You can't use a class for the handles, so I tried using each() to loop
> over the resizables and specify the handles using unique ids. I tried
> passing DOM elements for the handles.
>
> What is the trick to having multiple resizables?



[jQuery] Main jQuery Site Problems

2007-07-06 Thread Dave Probert

FAO: John, et al.

Main jQuery Site seems to have a problem on many pages - message at
the top claiming that "jQuery JavaScript Library has a problem" and
continues to load the main content over this (sometimes!)

Some of the tutorials, etc don't actually load.

Just a heads up :)

Cheers
Dave



[jQuery] Re: What would be the best way to accomplish this?

2007-07-04 Thread Dave Probert

Sorry mate, your link doesn't work.



On Jul 4, 2:09 pm, "Armand Datema" <[EMAIL PROTECTED]> wrote:
> http://nokiko.howardshome.com/jqhowto.gif
>
> I am looking for the best way to create the above design. You have a
> title and a summary, you only get to see one line of the summary and
> need to click to see the rest.
>
> Is there an easy way to do this that it only displayss the first line
> or do i need to figure this out in another way?
>
> thanks for any help
>
> Armand



[jQuery] Re: .fadeOut In mutiple elements don't work. why? what's wrong?

2007-07-04 Thread Dave Probert

Sorry mate, but you are breaking the rules of HTML (as laid down by
higher powers than us), as was mentioned above - ID's are individual
items on a page - There should NEVER be more than one with the same
ID.  These are Unique ID's.

You will need to go back to your original design and change it so that
you use different ID's and/or have some named class that each of the
elements has.
eg.
hi
bye


The class does Not have to contain any markup control (ie it is only a
name that can be accessed via jQuery (or whatever))

Then $('.xxabc').fadeOut('slow') would fade all of these elements at
the same time.

On Jul 4, 5:47 am, Alexsandro_xpt <[EMAIL PROTECTED]> wrote:
> =/
>
> Sorry, but I can't have objects contains like that.. My HTML is like
> that:
>
> hi
> bye
> .
> .
> .
> .
> .
> .
> .
> 
> ...table info...
> 
>
> thank you.