<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>My New Page</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<!-- <script type="text/javascript" src="C:\Users\31055\Downloads\openlogic-jquery-1.6.2-all-src-1\jquery-1.6.2-src\jquery-1.6.2.js"></script>-->
<!-- <script type="text/javascript">
$(document).ready(function () {
alert('okay');
debugger;
$.ajax({
// JQuery.support.cors=true;
// url: 'http://rest.learncode.academy/api/will/friends',
url: 'http://hsapirepo.azurewebsites.net/api/hs/salunkhe/moodkyahai ',
type: "POST",
dataType: "json",
async: true,
crossDomain: true,
processData: false,
contentType: false,
data:'C:\Users\31055\Desktop\kasam.png',
success: function (data) {
debugger;
lbl.innerHTML ='Name='+ data[0].name+'and Age='+data[0].age +'and id='+data[0].id;
$('#popupdiv').html(data[0].name.toString());
},
error: function () {
debugger;
ErrorFunction();
}
});
// $.ajax({
//
// async: true,
// crossDomain: true,
// url: 'http://hsapirepo.azurewebsites.net/api/hs/salunkhe/moodkyahai',
// method: 'POST',
// headers: {
// 'cache-control': 'no-cache',
// 'postman-token': '1b9f30b4-9d66-d59e-7e44-0a2f7f45c0f4'
// }
// });
// $.ajax(settings).done(function (response) {
// debugger
// console.log(response);
// });
});
function ErrorFunction() {
lbl.innerHTML = "No Data";
}
</script>-->
<script type="text/javascript">
$(document).ready(function () {
$('#_testButton').click(function () {
debugger;
var file = document.getElementById('_testFile').files[0];
var serverUrl = 'http://hsapirepo.azurewebsites.net/api/hs/salunkhe/moodkyahai';
$.ajax({
type: "POST",
beforeSend: function (request) {
request.setRequestHeader("Content-Type", file.type);
},
url: serverUrl,
data: file,
processData: false,
contentType: false,
success: function (data) {
lbl.innerHTML = data.toString();
},
error: function (data) {
debugger;
var obj = jQuery.parseJSON(data);
alert(obj.error);
}
});
});
});
</script>
</head>
<body>
<form action="#">
<input type=file name="_testFile" id="_testFile" />
<input type="button" id="_testButton" />
<div id="popupdiv" style="Background-color:Aqua;">
</div>
<label id="lbl"></label>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>My New Page</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<!-- <script type="text/javascript" src="C:\Users\31055\Downloads\openlogic-jquery-1.6.2-all-src-1\jquery-1.6.2-src\jquery-1.6.2.js"></script>-->
<!-- <script type="text/javascript">
$(document).ready(function () {
alert('okay');
debugger;
$.ajax({
// JQuery.support.cors=true;
// url: 'http://rest.learncode.academy/api/will/friends',
url: 'http://hsapirepo.azurewebsites.net/api/hs/salunkhe/moodkyahai ',
type: "POST",
dataType: "json",
async: true,
crossDomain: true,
processData: false,
contentType: false,
data:'C:\Users\31055\Desktop\kasam.png',
success: function (data) {
debugger;
lbl.innerHTML ='Name='+ data[0].name+'and Age='+data[0].age +'and id='+data[0].id;
$('#popupdiv').html(data[0].name.toString());
},
error: function () {
debugger;
ErrorFunction();
}
});
// $.ajax({
//
// async: true,
// crossDomain: true,
// url: 'http://hsapirepo.azurewebsites.net/api/hs/salunkhe/moodkyahai',
// method: 'POST',
// headers: {
// 'cache-control': 'no-cache',
// 'postman-token': '1b9f30b4-9d66-d59e-7e44-0a2f7f45c0f4'
// }
// });
// $.ajax(settings).done(function (response) {
// debugger
// console.log(response);
// });
});
function ErrorFunction() {
lbl.innerHTML = "No Data";
}
</script>-->
<script type="text/javascript">
$(document).ready(function () {
$('#_testButton').click(function () {
debugger;
var file = document.getElementById('_testFile').files[0];
var serverUrl = 'http://hsapirepo.azurewebsites.net/api/hs/salunkhe/moodkyahai';
$.ajax({
type: "POST",
beforeSend: function (request) {
request.setRequestHeader("Content-Type", file.type);
},
url: serverUrl,
data: file,
processData: false,
contentType: false,
success: function (data) {
lbl.innerHTML = data.toString();
},
error: function (data) {
debugger;
var obj = jQuery.parseJSON(data);
alert(obj.error);
}
});
});
});
</script>
</head>
<body>
<form action="#">
<input type=file name="_testFile" id="_testFile" />
<input type="button" id="_testButton" />
<div id="popupdiv" style="Background-color:Aqua;">
</div>
<label id="lbl"></label>
</form>
</body>
</html>