[jQuery] Re: "please wait while loading..."

2008-12-11 Thread Kevin Thorpe


fabrice.regnier wrote:

Hi to all,

i have a nice gif "please wait while loading..." and i'd like to show
it when i click on a button. Is there a nice jquery way to do it ? do
i need a plugin ?

$("#Idsubmit").click(function () {
   --> start showing the gif
   long process
  --> stop showing the gif

});
  

Easiest is to do it directly:
$("#Idsubmit").click(function () {
   $("#nicegif").show();
   long process
   $("#nicegif").hide();
});

I do it all the time.


[jQuery] Re: How do I build a variable array/object to use $.post?

2008-12-05 Thread Kevin Thorpe
Kevin Thorpe wrote:
> Hi, I'm struggling a bit to get $.post to work. I can get it working 
> as documented, ie.
> $.post("url", { param1: 1, param2: 2 } );
> but I want variable fields on my form (identified by the class 
> 'edit_field') to be posted to the url
> I thought the approach below would work, postdata is built correctly, 
> but it sends nothing.
> What  am I doing wrong?
> thanks
>
>   var postdata = [];
>
>   // get all the edit fields
>   $.each($('.edit_field'),function() {
> postdata[this.name] = $(this).val();
>   });
>
>   // and sent it away
>   $.post("/spt/newcanonical",
>  postdata,
>  function(data) {
>alert(data);
>  });
>
>
Oh. I'm an idiot!

I was creating an array, not an object. I didn't realise the subtle 
difference between the two. Changing postdata = [] to postdata = {} 
fixes it.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"jQuery (English)" group.
To post to this group, send email to jquery-en@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-en?hl=en
-~--~~~~--~~--~--~---



[jQuery] How do I build a variable array/object to use $.post?

2008-12-05 Thread Kevin Thorpe
Hi, I'm struggling a bit to get $.post to work. I can get it working as 
documented, ie.

$.post("url", { param1: 1, param2: 2 } );
but I want variable fields on my form (identified by the class 
'edit_field') to be posted to the url
I thought the approach below would work, postdata is built correctly, 
but it sends nothing.

What  am I doing wrong?
thanks

 var postdata = [];

 // get all the edit fields
 $.each($('.edit_field'),function() {
   postdata[this.name] = $(this).val();
 });

 // and sent it away
 $.post("/spt/newcanonical",
postdata,
function(data) {
  alert(data);
});




[jQuery] Re: Questions regarding $.ajax ...

2008-12-03 Thread Kevin Thorpe

mhall wrote:

Hi all, first post.

I'm in the processing of learning javascript and jQuery. I have a CGI
application that I have written and have been using in my business for
several years. It's written in a rather obscure CGI language called
WebBatch. Why? Well, because it's what I knew at the time I started
the project. :)

Anyway, one of the interesting things about that language is the
structure of its URLs - it isn't simply the path to a script in a cgi
directory, it's a path to the WebBatch executable with the script to
execute embedded in the query string after it like so:

http://atlas/webcgi/webbatch.exe?ordersys-dev/login.web

I mention that as I am having problems with the POST method in Ajax. I
can use the GET method just fine and load files and run scripts using
GET all day long, but I can't get any results when attempting to use
post - the script itself never executes on the server (I have a test
script that just writes out to a log file when it runs so that I can
see if it is executing).

Is there a chance that the unusual structure of the URLs presents an
issue with the POST method? I'm grasping at straws here as I've been
over everything for hours and can't think out anything else unusual
about what I'm trying to do or how I'm trying to do it.

Does that sound like it could even remotely be a source of the
problem, or do you figure I am completely off base?

This is the ajax call as I have it formatted currently:

 $.ajax({
   type: "POST",
  url: 
"//atlas/webcgi/webbatch.exe?ordersys-dev/login-ajax.web",
   data: '"username=' + elem.form.username.value + '&password=' 
+
elem.form.password.value + '"',
   success: function(msg){
 alert( "Data Saved: " + msg );
   }
 });


Thanks for any thoughts!
Micheal
  
What you're trying to do here is both a GET and a POST in the same 
query. Webbatch expects a raw QUERY_STRING as the
script to execute and the data in POST_DATA (or whatever it's called). 
Check your web logs. Is jquery stripping the GET part
from the URL? Certainly the server side can handle combined GET and 
POST, I've done it myself due to restrictions in certain

frameworks.



[jQuery] Re: call a php function with onclick

2008-10-22 Thread Kevin Thorpe

stefano wrote:
> Hi, I would like to know how it is possibile to call a php function
> inside an onclick=function (), I try to explain me better
Hi Stefano. Your problem is that php is on the server and 
javascript/jQuery is in the web browser.
You need to get onclick to issue another page request to the server - 
that's AJAX. Look into
$.get for a solution.


[jQuery] Re: Page Content fetch via GET

2008-07-10 Thread Kevin Thorpe

SumanShakya wrote:
> hi all,
> i have a problem.
> I need to fetch page content via "get". After data is fetched, i need
> to perform 2-3 manipulation on data before showing the actual content.
> Each manipulation modifies the page content. I am using the code shown
> below
>
> $.get(url,function(data) {
>   $('#container').html(data);
>   //manipulation code
>   //manipulation code
>   //manipulation code
> });
>
> The problem is after each manipulation, modified data shows up in the
> container and then the final content appears at last. This makes the
> page appear flickering. I need to show only the final content.
>
> How can i achieve this??
>
> Thanks for help in advance
> Suman Shakya
>   
do it the other way round. Manipulate data then do the 
$('#container').html(data);


[jQuery] IE7 not adjusting width of select box

2008-02-04 Thread Kevin Thorpe

I'm having a spot of bother with select boxes in IE7. I have one select 
box which empties and refills a second when the
selected item changes using an AJAX call. This works fine in Opera and 
FireFox but IE7 doesn't adjust the width of the
second select box to match the new contents. There must be a simple 
workaround for this but for the life of me I can't
find it. I don't really want to fix the size in CSS. My code is below, 
the AJAX page just returns a list of val=text pairs to
populate the select box.

Thanks for any assistance.

  $(document).ready(function(){
$("#brandlist").focus().change(function(){
  $('#matches').empty();
  $.get("brand.map.helper.php",
{ code: $(this).val() },
function(data) {
  var matches = data.split("\n");
  $("#sql").html(matches[0] + "" + matches[1]);
  for (var i=2; i

[jQuery] Re: Help with draggable / droppable

2008-01-21 Thread Kevin Thorpe
The problem is, I think, that the draggable plugin if used without a 
helper modifies the dragged element to position: absolute.
At that point moving it in the DOM doesn't have any visible effect, it 
simply sits where I let go of it instead of 'snapping' into
the destination cell. I've got it working with a helper though.

Scott González wrote:
> The draggable plugin only moves the element on screen (changes it's
> top and left offset), it does not natively affect the DOM in any other
> way.  The proper way to handle this is to do what you did in the drop
> callback, which is to modify the DOM yourself, but you shouldn't need
> a cloned helper to accomplish this.
>
>
> On Jan 18, 9:55 am, Kevin Thorpe <[EMAIL PROTECTED]> wrote:
>   
>> Thanks for your comments. I've just cracked it (I think). I was getting
>> the drop event ok but couldn't work out how to move the dragged div. It
>> was just sitting where I'd dropped it.
>>
>> The secret is to use a cloned helper with $('.drag').draggable({helper:
>> 'clone'}); and then move the original draggable div using:
>> $(".drop").droppable({
>> accept: ".drag",
>> tolerance: 'pointer',
>> activeClass: 'droppable-active',
>> hoverClass: 'droppable-hover',
>> drop: function(ev, ui) {
>>   if (this.children.length == 0) {
>> $(this).append(ui.draggable.element);
>>   }
>>     }
>> });
>> I think my problem was that without a helper the draggable div is
>> converted to position: absolute so that it didn't matter which table
>> cell it was in.
>>
>> I just wish I knew more about the DOM.
>> 


-- 
Kevin Thorpe
Head of IT
Purchasing Index Ltd
Southbank House
Black Prince Road
London SE1 7SJ
tel: 020 7463 2022
fax: 020 7463 2025

Mailto: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
URL: http://www.pricetrak.com
*/Registered in England No. 1728605/*

All views or opinions expressed in this message are solely those of the 
author. Accordingly, Purchasing Index Ltd does not accept responsibility 
for the contents of the message unless specifically stated otherwise. If 
you have received this message in error, please notify the sender and 
delete the message immediately.


[jQuery] Re: Help with draggable / droppable

2008-01-18 Thread Kevin Thorpe

Thanks for your comments. I've just cracked it (I think). I was getting 
the drop event ok but couldn't work out how to move the dragged div. It 
was just sitting where I'd dropped it.

The secret is to use a cloned helper with $('.drag').draggable({helper: 
'clone'}); and then move the original draggable div using:
$(".drop").droppable({
accept: ".drag",
tolerance: 'pointer',
activeClass: 'droppable-active',
hoverClass: 'droppable-hover',
drop: function(ev, ui) {
  if (this.children.length == 0) {
$(this).append(ui.draggable.element);
  }
}
});
I think my problem was that without a helper the draggable div is 
converted to position: absolute so that it didn't matter which table 
cell it was in.

I just wish I knew more about the DOM.


[jQuery] Help with draggable / droppable

2008-01-18 Thread Kevin Thorpe

I'm wondering if anyone would be kind enough to help me with draggable 
and droppable. I'm relatively inexperienced in jquery and css.

What I want to do is show a list of draggable blocks (referring to the 
column headings in a CSV file) and to be able to sort them into a set of 
boxes (fields in a database table).

I have a table where the cells contain a set of draggable s and a 
destination table with droppable s and this bit works fine, I get 
the event on dropping a div in the table cell.

What I can't figure out though is how to move the  from the source 
table cell to the destination table cell. It simply sits where I dropped 
it on the page. Can anyone please enlighten me on this?

thanks
Kevin Thorpe