Hi,

Thanks for the reply, but I don't think that's it. The second argument to
.load() is data to be posted to the server. Your version of the call does a
full load.

In my example "#script" is a jQuery selector. I'm trying to .load() just the
"#script" div from the "has_script.htm" page. The call .load("has_script.htm
#script") successfully loads in just the div, but it also strips out any
<script> tags.

Cheers,

Chris

2008/10/6 Adrian Lynch <[EMAIL PROTECTED]>

>
> I haven't used a partial load in a  while, but could it be you have a
> typo:
>
> $("#load_target").load("has_script.htm #script");
>
> Should be:
>
> $("#load_target").load("has_script.htm", "#script");
>
> Adrian
>
> On Oct 6, 4:24 am, ctford <[EMAIL PROTECTED]> wrote:
> > When I use .load() to pull in a whole page, script tags are correctly
> pulled
> > in and executed. However, if I add a selector to the .load() call all
> script
> > tags get stripped out. In the following example, the heading from the
> second
> > HTML file gets pulled in, but the JS with the alert does not. Could this
> be
> > a bug?
> >
> > <html>
> >         <head>
> >                 <title>Ajax</title>
> >                 <script type="text/javascript"
> src="jquery-1.2.6.min.js"></script>
> >         </head>
> >
> >         <body>
> >                 <div id="load_target"></div>
> >                 <script type="text/javascript">
> >                         $("#load_target").load("has_script.htm #script");
> >                 </script>
> >         </body>
> > </html>
> >
> > <html>
> >         <head>
> >                 <title>Script</title>
> >         </head>
> >
> >         <body>
> >                 <div id="script" >
> >                         <h1>Heading</h1>
> >                         <script type="text/javascript">
> >                                 alert('Hi');
> >                         </script>
> >                 </div>
> >         </body>
> > </html>
> > --
> > View this message in context:
> http://www.nabble.com/Partial-load-strips-out-script-tags--tp19830989...
> > Sent from the jQuery General Discussion mailing list archive at
> Nabble.com.
>

Reply via email to