Tag: c#

如何在jquery中将html2canvas图像保存到系统文件夹中

我在这个表单中有一个id =“form1”的表单我有一个图表。现在我使用html2canvas来获取此form1的图像。这是我的代码.. $(document).ready(function () { $(‘#add_button’).click(function () { alert(“hiii”); $(‘form1’).html2canvas(); var queue = html2canvas.Parse(); var canvas = html2canvas.Renderer(queue, { elements: { length: 1} }); var img = canvas.toDataURL(); window.open(img); alert(“Hello”); }); }); Demo 所以我的问题是如何将此图像保存到我的系统硬盘中。请帮助我。

使用jQuery将数据发布到MVC操作方法

我正在尝试使用下面的方法使用jQuery Ajax将数据发布到MVC操作。 但是在控制器内部,所有模型属性始终为null 。 不知道我在这里缺少什么。 .CSHTML Texas Oklahoma Ohio Active Deleted Pending JavaScript的 $(function () { $(“#Save”).click(function (e) { var dataToPost = $(“#MyForm”).serialize() $.ajax( { type: “POST”, data: JSON.stringify(dataToPost), url: “Working/Save”, contentType: ‘application/json; charset=utf-8’ }) }) }) 调节器 public class WorkingController : Controller { // GET: Working public ActionResult Index() { return View(); } public […]

使用jQuery AJAX的ASP.Net MVC路由问题

我的页面是domain.com/home/details/1 在我的jQuery AJAX调用中,我有以下内容,但当它调用它调用domain.com/home/details/home/getdata时 我该怎么做才能让它得到妥善解决? $(document).ready(function () { oTable = $(‘#example’).dataTable({ “bServerSide”: true, “sAjaxSource”: “Home/GetData/”, “bProcessing”: true, “bPaginate”: true, “sPaginationType”: “full_numbers”, “bFilter”: true, “bAutoWidth”: false, “fnServerData”: function (sSource, aoData, fnCallback) { /* Add some extra data to the sender */ //aoData.push({ “filtervalue”: $(‘#filtervalue’).val(), “Options”: $(‘#Options’).val() }); $.getJSON(sSource, aoData.concat($(‘form’).serializeArray()), function (json) { /* Do whatever additional processing […]

服务器上的AJAX成功函数

这适用于我的开发机器,但不适用于生产服务器。 我试图用ajax更新一些div,但它们没有更新,虽然其他部分工作正常。 我在服务器上使用IIS 6。 当我使用firebug在服务器端调试此代码时,它不会触及我添加到success函数的任何断点。 脚本: function updateServiceInfo(nodeId) { var id = { id: nodeId }; $.ajax({ url: ‘/ServiceInfo/ServiceInfoPartial’, type: ‘GET’, data: id, dataType: ‘html’, success: function (data) { $(‘#serviceInfoContent’).html(data); }, error: function (request, error) { } }); } 控制器: public class ServiceInfoController : Controller { public ActionResult ServiceInfo() { return PartialView(“ServiceInfo”); } public ActionResult […]

MVC3 Razor和Modal弹出窗口

我需要一个Modal弹出窗口,显示一个将数据保存回db的表单。 这样做有很好的例子吗? Ajax更灵活还是使用jquery对话框?

根据控制器响应动态更改视图的各个部分

我正在寻找以下方案的最佳方法建议: 用户可以选择一个或多个csv文件进行validation(附件1),其中“validation”按钮单击会通过validation代码(显示进度条直到它返回输出)。 返回响应是成功消息或选择用于validation的每个文件的错误详细信息(附件2) 现在可以使用“上传”按钮将成功validation的文件上载到azure存储。 附件1 附件2 现在,为了使一切都异步 ,我的想法是视图需要为每个文件提供单独的灵活部分。 我正在使用knockout.js处理MVC5 razor视图,我对部分视图有不错的想法,但我不确定如何解决这个问题。 如果不是部分观点,那么最好的方法是什么。

使用jquery加密用户密码并使用C#解密

我不想使用SSL来加密我正在构建的网站的注册和登录表单。 我没有钱支付证书。 我需要在我的asp.net网站上使用带有Jquery的enryption和C#的解密。 有人有一个例子,采用这种方法有什么安全吗?

将所选的多选值传递给控制器​​操作

我正在尝试将所选多选列表的选定值发送到控制器中的操作。 我已经validation了val()确实显示了一个选定值的数组,如[“33”,“175”],当我打印到控制台但Action的参数始终为null。 我尝试将参数类型更改为object并validation它不是null但我无法解析值。 有什么建议? 拜托,谢谢! Ajax调用: $(“.chosen-select”).on(“change”, function (event, params) { console.log($(“.chosen-select”).val()); $.ajax({ url: ‘@Url.Action(“BDOReferralSourcesTableHTML”,”ReferralNetwork”)’, type: ‘GET’, dataType: ‘json’, cache: false, data: { bdoIds: $(“.chosen-select”).val() }, success: function (response) { if (response.length > 0) { alert(response); } else { alert(“response length zero”); } } }); }); 控制器动作: public ActionResult BDOReferralSourcesTableHTML(string[] bdoIds) { return Content(“test”, “text/html”); […]

将C#属性读入JQuery代码

我正在尝试从我的代码隐藏文件中读取C#属性的值到一些JQuery脚本(见下文)。 我编写的JQuery选择器访问ASP.Net GridView,然后访问gridview中的CheckBox字段。 每当选中或取消选中复选框时,代码都会被命中,但我需要从后面的代码中访问C#属性,以根据属性的值采取适当的操作。 $(“.AspNet-GridView-Normal > td > input”).click(function() { //Need to access the C# property here //Take action here based on the value of the C# property });

从jquery ajax GET将多个参数传递给.asmx

HTML fill in names and check it out Enter First Name Enter Last Name C# [WebMethod(EnableSession = true)] [ScriptMethod(UseHttpGet = true)] public string testGetParametersDynamic(string firstName, string lastName) { string fullName = firstName + lastName; return fullName; } 我已经尝试了多种输入数据的方法bc我认为这就是问题所在 尝试1 function testGetParametersDynamic2() { $.ajax( { post: ‘GET’, contentType: ‘application/json; charset=utf-8’, dataType: ‘json’, data: ‘{“firstName”:”‘ + $(‘#myFirstName’).val() […]