jQuery Tutorial


jQuery Example


jQuery References


jQuery Ajax getScript() Method Reference


  jQuery Ajax Method References


Uses

jQuery AJAX getScript() method Load URL for requested JavaScript document to open.


Syntax

$.getScript(url,[callback])

jQuery Ajax getScript() Method support following parameter.

Parameter Description
url url is required parameter. String containing the URL to which the request is sent.
callback Callback is optional parameter. It is use to represents a function to be executed whenever effect is completed.
External File Create
(namejs.js)
Write Down following code in namejs.js file.
function nameAlert(){
   alert("My Name is Jay Patel");
}

jQuery Ajax getScript() method Example

<script type="text/javascript"> 
$(document).ready(function(){
    $("button").click(function(){
    	$.getScript('namejs.js',function(){
        	nameAlert();
	});
    });
});
<script>
Online Try This Code Your Self....   »

  jQuery Ajax Method References