javascript - AJAX: Pass a value to ajax method -
javascript - AJAX: Pass a value to ajax method -
ive tried couple out-of-the-box ways trying value ajax everytime js error's. 1 of can help.
i have next jquery ajax:
$("#usertasklist").click(function () { $('#basicmodal4').modal('hide'); $.ajax({ type: "get", url: "/home/getajaxusertasksexecuted", data: { filterdate: variable1 }, datatype: "html", success: function (data) { console.log("succes!"); var $titlediv = $('#modal5label'); $titlediv.replacewith("<h3><b>user tasks executed</b></h3>"); var $detaildiv = $('#superdatadivthing3'); $detaildiv.replacewith(data); }, error: function () { console.log("error!"); }, complete: function () { $('#basicmodal5').modal('show'); console.log("complete!"); } }); });
and viewbag in controller
session["usercode"];
how can pass value view handbag replace "variable1" in info section of ajax call?
how getting info container?
html-example
<table id="yourdivhere"> <tr> <td> <span>data use</span> </td> </tr> </table>
your ajax-call
$("#usertasklist").click(function () { $('#basicmodal4').modal('hide'); var info = innerxhtml($('#yourdivhere').attr('id')); $.ajax({ type: "get", url: "/home/getajaxusertasksexecuted", data: { filterdate: info }, datatype: "html", success: function (data) { console.log("succes!"); var $titlediv = $('#modal5label'); $titlediv.replacewith("<h3><b>user tasks executed</b></h3>"); var $detaildiv = $('#superdatadivthing3'); $detaildiv.replacewith(data); }, error: function () { console.log("error!"); }, complete: function () { $('#basicmodal5').modal('show'); console.log("complete!"); } }); });
javascript jquery ajax json
Comments
Post a Comment