How to enable jquery in a loaded page?

Discussion in 'jQuery' started by 123GoToAndPlay, Feb 6, 2009.

  1. #1
    Hi there,

    I am having a problem to enable jquey in a loaded page.

    For example:

    base.php has jquery and i load showContent.php like:

    $(document).ready(function() {
    	$("#show").click(function() {
    		$("#content").css("overflow-y", "scroll");
        	$("#content").load("showContent.php");
       		});
    Code (markup):
    but now the jquery in showContent.php doesn't work.

    if i directly browse to showContent.php the jquery does work

    Any tips?
     
    123GoToAndPlay, Feb 6, 2009 IP
  2. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #2
    i assume #content is an iframe? whichever - and no, the .load mechanism won't re-load jquery, re-run the document.ready and so forth - it ALREADY is ready. it probably won't eval the js there either. not sure - in mootools for similar methods, you can do things like:
    ... "showcontent.php", { 
        evalResponse: false,
        evalScripts: true,
        update: $("content")
    }); 
    PHP:
    once again though, once you find the equivalent syntax, you need to make sure the scripts being run are not geared up to run on a document ready event only. good luck, hopefully some jquery expert can help - but you can always try the jquery mail group on google, i hear its very good.
     
    dimitar christoff, Feb 6, 2009 IP