0
Yes,
Ajax call method must be a public to interct with client side ajax call.
0
The access modifier of `exportPDF` makes the difference here. It worked when `private` is modified to `public`.
0
Hey Ketan, I created and called jQuery AJAX function on button click but it did returned the same error 404 - The resource cannot be found.
- <script type="text/javascript">
- $(document).ready(function () {
- $('#btnExportHTML').click(function () {
- console.log($("#tblEmpData").html());
- debugger;
- $.ajax({
- url: "@Url.Action("exportPDF", "Home")",
- data: { gridHTML: $("#tblEmpData").html() },
- contentType: 'application/json;charset=utf-8',
- type: 'POST',
- success: function (data) {
- console.log($("#tblEmpData").html());
- },
- error: function (err) {
- console.error(err.responseText);
- }
- });
- });
- });
- </script>
Can't figure out what's my mistake here. 0
Yes,
jquery ajax call.
on button click of jquery in document ready
Call
$.ajax({
url:'contollerPath/methodName',
data:{gridHTML:yourValue}, //For passing request parameter
contentType: 'application/json;charset=utf-8',
type="POST/GET",
success: function (data) {
console.log(data.d);
},
error: function (err) {
console.log(err.responseText);
}
})
0
Hello ketan hirapara, thanks for your response, do youmean to use jQuery AJAX for button click.? I'm a beginner, so can please explain in detail an approach to solve this.
0
hi Learn Avid,
Just call exportPDF using ajax. with parameter gridHTML.