I have this function that not work in another .js file
$('#Button1').click(function () {
var channelId = '55';
var matn = 'some';
alert('s');
$.ajax({
type: 'POST',
url: 'savedata.aspx/insertdata',
async: false,
data: "{'channelId':'" + channelId + "','matn':'" + matn + "'}",
contentType: 'application/json; charset =utf-8',
success: function (data) {
var obj = data.d;
if (obj == 'true')
alert("Data Saved Successfully");
},
error: function (result) {
alert("Error Occured, Try Again");
}
});
})
When I write it in html file it works properly but when I put it in another .js file it doesn't work here is head of my html
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
and i put this inside of my body
<script src="gh.js" type="text/javascript"></script>