0

So, we can use

jQuery.ajax({
  success: function(result){}
});

to make an Ajax request, and get the result.

Now, I found out that you can't select anything inside the head tag of the result. this simply fails:

jQuery( 'script', result )

but I can select div's and such. Why? How to get around this?

1

3 Answers 3

1

See Trying to select script tags from a jQuery ajax get response

Sign up to request clarification or add additional context in comments.

1 Comment

I've been trying to use RegEx for this with no luck for hours. This should work but I don't know why it doesn't: <script>([^<\/script>])<\/script> which should select from script tag until it reaches the end of it. No luck with this either: <script>([.+]) it returns nothing.
0

The proper way to get scripts is to use $.getScript() I say this only because it's the proper way to execute function after page has loaded.

jQuery.getScript() - official page

Comments

0

The script does not get put on the page. It gets eval'ed by jquery see: Trying to select script tags from a jQuery ajax get response

What I am trying to do is find out where on the page we were when the script was created (created from a tag). Aurgh!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.