In this post, I want to explain loading javascript files with jquery. Here demo regional language textbox contains many javascript files, so just loading files with jquery when the file required. It's useful to faster your page loading time.
Sample Script
<script type="text/javascript" src="http://ajax.googleapis.com/
ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(function()
{
$(".language").change(function(){
var id = $(this).attr("value");
if(id == 'hindi')
{
$.ajax({
type: "GET",
url: "hindi.js",
dataType: "script"
});
}
else
{
$.ajax({
type: "GET",
url: "telugu.js",
dataType: "script"
});
}
return false;
});
});
</script>
<select class="language">
<option value="hindi" >Hindi</option>
<option value="telugu">Telugu</option>
</select>


