jQuery ajax() Load js from ajax

Description

jQuery ajax() Load js from ajax

View in separate window

<!DOCTYPE html>
<html>
<head>
<script 
 src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>/*from  w w  w  .ja  v  a  2  s  .c o m*/
<script>
$(document).ready(function(){
  $("button").click(function(){
    $.ajax({url: "ajax.js", dataType: "script"});
  });
});
</script>
</head>
<body>

<button>Use Ajax to get and then run a JavaScript</button>

</body>
</html>



PreviousNext

Related