[jQuery] $(document).ready on an ajax return?

2008-12-16 Thread davidgregan

I'm using a $.get call to get the contents for a dialog box and I'm
trying to run the $(document).ready on the ajax return like so:

parentPage.html:
$.get('desiredContent.html',function(data){
$(#dialogBoxDiv).html(data);
$(#dialogBoxDiv).dialog('open');
}

desiredContent.html:
$(document).ready(function() {
alert(content loaded!);
});

this works fine for firefox, but ie won't run the $(document).ready()
function on the desiredContent page. Is there a way to do this that
will work in both firefox and ie?

Thanks!


[jQuery] Re: $(document).ready on an ajax return?

2008-12-16 Thread davidgregan

sorry, I may have oversimplified my example above, replace alert
(content Loaded); with this:

$(#childInput).change(function()
{
alert(input changed!);
});

so I want to add an event to a DOM element in the loaded page so the
DOM has to be ready before I can execute the code. The method you
suggest will work fine for alerts, but it doesn't seem to work for
adding events like above, at least not in IE.

Thanks.

On Dec 16, 9:33 am, rernens robert.ern...@look2bookonline.com wrote:
 There is no need to run $(document).ready when loading a page with
 ajax using
 jQuery. The scripts contained in the loaded content are automatically
 evaluated after the load has been successfull. You should insert at
 the end of the document you are loading
 script type=text/javascript
 alert(content loaded)
 /script

 It will work flawlessly in both browsers.

 On 16 déc, 17:13, davidgregan davidgre...@gmail.com wrote:

  I'm using a $.get call to get the contents for a dialog box and I'm
  trying to run the $(document).ready on the ajax return like so:

  parentPage.html:
  $.get('desiredContent.html',function(data){
  $(#dialogBoxDiv).html(data);
  $(#dialogBoxDiv).dialog('open');

  }

  desiredContent.html:
  $(document).ready(function() {
  alert(content loaded!);

  });

  this works fine for firefox, but ie won't run the $(document).ready()
  function on the desiredContent page. Is there a way to do this that
  will work in both firefox and ie?

  Thanks!


[jQuery] Re: $(document).ready on an ajax return?

2008-12-16 Thread davidgregan

I'd like to add that I can't even access the new DOM elements in IE in
the $.get() callback function,  but I can in firefox. it's like IE
doesn't insert the new HTML into the dom until after the callback is
executed. that sucks! ;P

On Dec 16, 9:42 am, davidgregan davidgre...@gmail.com wrote:
 sorry, I may have oversimplified my example above, replace alert
 (content Loaded); with this:

 $(#childInput).change(function()
 {
 alert(input changed!);

 });

 so I want to add an event to a DOM element in the loaded page so the
 DOM has to be ready before I can execute the code. The method you
 suggest will work fine for alerts, but it doesn't seem to work for
 adding events like above, at least not in IE.

 Thanks.

 On Dec 16, 9:33 am, rernens robert.ern...@look2bookonline.com wrote:

  There is no need to run $(document).ready when loading a page with
  ajax using
  jQuery. The scripts contained in the loaded content are automatically
  evaluated after the load has been successfull. You should insert at
  the end of the document you are loading
  script type=text/javascript
  alert(content loaded)
  /script

  It will work flawlessly in both browsers.

  On 16 déc, 17:13, davidgregan davidgre...@gmail.com wrote:

   I'm using a $.get call to get the contents for a dialog box and I'm
   trying to run the $(document).ready on the ajax return like so:

   parentPage.html:
   $.get('desiredContent.html',function(data){
   $(#dialogBoxDiv).html(data);
   $(#dialogBoxDiv).dialog('open');

   }

   desiredContent.html:
   $(document).ready(function() {
   alert(content loaded!);

   });

   this works fine for firefox, but ie won't run the $(document).ready()
   function on the desiredContent page. Is there a way to do this that
   will work in both firefox and ie?

   Thanks!


[jQuery] Re: $(document).ready on an ajax return?

2008-12-16 Thread davidgregan

okay, I've figured this out. the problem I was having was a
combination of 1) ie's $(element).change() event doesn't fire until
after the element looses focus (i use click() instead) and 2)
refreshing ie doesn't always refresh the page, there's some funky
caching going on so the changes I had made weren't showing up.

On Dec 16, 10:14 am, davidgregan davidgre...@gmail.com wrote:
 I'd like to add that I can't even access the new DOM elements in IE in
 the $.get() callback function,  but I can in firefox. it's like IE
 doesn't insert the new HTML into the dom until after the callback is
 executed. that sucks! ;P

 On Dec 16, 9:42 am, davidgregan davidgre...@gmail.com wrote:

  sorry, I may have oversimplified my example above, replace alert
  (content Loaded); with this:

  $(#childInput).change(function()
  {
  alert(input changed!);

  });

  so I want to add an event to a DOM element in the loaded page so the
  DOM has to be ready before I can execute the code. The method you
  suggest will work fine for alerts, but it doesn't seem to work for
  adding events like above, at least not in IE.

  Thanks.

  On Dec 16, 9:33 am, rernens robert.ern...@look2bookonline.com wrote:

   There is no need to run $(document).ready when loading a page with
   ajax using
   jQuery. The scripts contained in the loaded content are automatically
   evaluated after the load has been successfull. You should insert at
   the end of the document you are loading
   script type=text/javascript
   alert(content loaded)
   /script

   It will work flawlessly in both browsers.

   On 16 déc, 17:13, davidgregan davidgre...@gmail.com wrote:

I'm using a $.get call to get the contents for a dialog box and I'm
trying to run the $(document).ready on the ajax return like so:

parentPage.html:
$.get('desiredContent.html',function(data){
$(#dialogBoxDiv).html(data);
$(#dialogBoxDiv).dialog('open');

}

desiredContent.html:
$(document).ready(function() {
alert(content loaded!);

});

this works fine for firefox, but ie won't run the $(document).ready()
function on the desiredContent page. Is there a way to do this that
will work in both firefox and ie?

Thanks!


[jQuery] Re: how do you get a div from an ajax form return?

2008-11-24 Thread davidgregan

Here is the call to the jquery ajax forms plugin:

$(#addForm).ajaxForm({ target: '.flexigrid'},
function() {
$(#CIPdocs).flexReload();
}
);

The target is the div that I am trying to upgrade. Basically, I am
using the form to add a record and then after that I want to refresh a
div. In the code behind, I just return the view after I add the record
so it makes sense that the entire page is stuck in the target div. I'm
just wondering if there is a way to refresh the div with just the
refreshed view's contents of the div. Maybe something like this?

$(#addForm).ajaxForm(
function(data) {
$(#flexigrid).html(data.find
(#flexigrid).html));
$(#CIPdocs).flexReload();
}
);

or is there a better or more conventional way?

On Nov 22, 6:04 pm, coughlinsmyalias [EMAIL PROTECTED] wrote:
 Hey,

 Can you send me your code to look at. Are you trying to update a DIV
 or use it as a succss show?

 On Nov 22, 6:08 pm, davidgregan [EMAIL PROTECTED] wrote:

  I'm using the jquery forms plugin for an ajax request and update. I
  set the target option to the desired div that I want to update. The
  problem that I'm running into is that it will update the div with the
  contents of the entire page rather than the just the contents of that
  div. I'd like to do this without creating another view for just the
  div alone. What is the proper way to do this? Return the calls results
  to a variable and then parse the variable for the desired div? Is
  there another way? Thanks in advanced.


[jQuery] how do you get a div from an ajax form return?

2008-11-22 Thread davidgregan

I'm using the jquery forms plugin for an ajax request and update. I
set the target option to the desired div that I want to update. The
problem that I'm running into is that it will update the div with the
contents of the entire page rather than the just the contents of that
div. I'd like to do this without creating another view for just the
div alone. What is the proper way to do this? Return the calls results
to a variable and then parse the variable for the desired div? Is
there another way? Thanks in advanced.