<a href="#" onclick="MyWindow=window.open('https://www.aspsnippets.com/Articles/660/Display-image-from-database-in-Image-control-without-using-Generic-Handler-in-ASPNet/','MyWindow','width=600,height=300'); ">click to open new window</a>
Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts
Friday, August 15, 2025
Friday, May 24, 2024
Calling a function in javascript anchor tag
<a class="link-offset-2 link-offset-3-hover link-underline link-underline-opacity-0 link-underline-opacity-75-hover" style="cursor: pointer" onclick="showCaseProfile(\'' + value.FileNumber + '\');">' + value.FileNumber + '</a>
function showCaseProfile(CaseNo) {
var params = { strCNR_No: CaseNo };
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: '../DashboardReports/DashboardReports.aspx/CNREncryption',
data: JSON.stringify(params),
dataType: "json",
success: function (data) {
window.open('../DashboardReports/CaseProfile.aspx?CaseNo=' + data.d, '_blank');
},
error: function (result) {
alert("Server Connection Error");
}
});
}
Wednesday, May 22, 2024
Jquery ajax - ASP.NET when exception occur in asp.net
success: function(data) {
if (typeof data == "string")
data = JSON.parse(data);
if (data.success) {
// Code if success.
} else {
// Code if error.
}
},
and when method not found, than it will gone to error or any function not called by ajax call.
$.ajax({
type: "POST",
data: formData,
url: "/Forms/GetJobData",
dataType: 'json',
contentType: false,
processData: false,
success: function (response) {
if (response.success) {
alert(response.responseText);
} else {
// DoSomethingElse()
alert(response.responseText);
}
},
error: function (response) { // // Added this event to capture the failed requests.
alert("error!"); //
}
});
ref:- https://stackoverflow.com/questions/37187699/ajax-error-is-returned-as-success
Subscribe to:
Posts (Atom)