0
$.ajax({   
    url: "sub_template5_js.php?content_id="+content_id,  
    dataType: 'html',
    success: function(data){  
        alert(data);
    }  
});

In above code, when i give alert data i get html with js script, i need to separate the javascript and append to the external .js file Pl. Help me

Thank you

1
  • i need to separate the javascript and append to the external .js file, It's not possible. Commented Feb 7, 2013 at 5:15

1 Answer 1

1

using script as selector should work..

$('script').text(); // use attribute selector to get a particular one .   

fiddle here

note: have to use loop , if incase you have more than one script tag.

this is just an example to get you started...

havn't tested with youe data part but you can try..

 data.find('script').text();
Sign up to request clarification or add additional context in comments.

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.