Tag: 发布

如何在wordpress中使用clone ajax和jquery创建元框

我想使用clone ajax和jquery在post(在Admin post面板中)创建4个元框。 我还需要添加“添加更多”和“删除”function。

使用POST的JQuery ajax从启用CORS的服务器获取image / png

我正在编写一个HTML5 / Backbone / Phonegap应用程序Github Repo ,它使用52n( v1 API Docs )的SensorObservationService REST API。 每个GET-Request工作正常 – 但现在我想下载POST请求后生成的图片。 但服务器响应状态400: statusCode”:400,”hints”:[“Check the message which has been sent to the server. Probably it is not valid.”],”reason”:”Bad Request”,”developerMessage”:”Could not read JSON statusCode”:400,”hints”:[“Check the message which has been sent to the server. Probably it is not valid.”],”reason”:”Bad Request”,”developerMessage”:”Could not read JSON […]

JQuery $ .post跨域和凭据

我编写了一个Web应用程序,它使用了许多带有JQuery的$.post调用。 现在我想发送withCredentials: true以保持会话活着,在$.ajax看起来像这样(并且也像这样工作): $.ajax({ type: ‘post’, url: ‘http://example.com/server/api.php’, crossDomain: true, dataType: “json”, xhrFields: { withCredentials: true }, data: { username : ‘test’, password : ‘test’ }, success: function (d) { $(‘body’).html(d.status); } }); 这是因为我现在想将PHP文件上传到我的服务器并使用Cordova导出客户端。 ( withCredentials: true仅包含因为在我的本地主机服务器上进行测试而包含的内容)我可以将其打包到$.post调用中,还是需要替换所有调用? (我会写一个类似于$ .post的新函数)

如何在javascript中使用MD5传输密码

我弹出一个jquery对话框模式框,用于登录我的网站。 当用户单击login时,它会对login.php文件发出post请求,如下所示: $.post( ‘includes/login.php’, { user: username, pass: password }, onLogin, ‘json’ ); 在将该密码放入发布请求之前,如何对该密码执行md5? 此外,我使用MD5()将用户的密码存储在MySQL数据库中,因此我只想将存储的密码版本与提交的密码的MD5进行比较。 感谢任何回复的人。

使用Ajax和jQuery发布表单

开始学习Ajax(和jQuery),我遇到了post表单数据的问题,我无法自行解决。 首先,这是一个简单的例子,我收集数据,发布并在新页面上显示: Check Box 1 Check Box 2 然后我尝试使用Ajax和jQuery。 我稍微修改了上面粘贴的表格: Check Box 1 Check Box 2 这是jQuery函数: // script.js $(document).ready(function () { $(“#myButton”).click(function () { $.ajax({ cache: false, type: ‘POST’, url: ‘test.php’, data: $(“#myForm”).serialize() }); }); }); 我的问题是,如何重新实现jQuery函数以在test.php选项卡中回显结果? 我抓了很多资源,但我找不到任何解决方案。 提前感谢任何指针。 最好的,Andrej

jQuery – Url.Action LOCAL机器路径问题

为什么只有我的本地机器要求我拥有以下内容: $.post(‘@Url.Action(“ControllerName/ActionName”)’, { param: valueHere }, function (result) { successFunc(result); }).fail(function (error) { alert(error); }); 在其他计算机上,这是正常的: $.post(‘@Url.Action(“ActionName”)’, { param: valueHere }, function (result) { successFunc(result); }).fail(function (error) { alert(error); }); 这对我的计算机不起作用: $.post(‘@Url.Action(“ActionName”, “ControllerName”)’, { param: valueHere }, function (result) { successFunc(result); }).fail(function (error) { alert(error); }); 我试图弄清楚为什么它不适用于我的一台计算机而不是所有计算机。 因此,拥有4台计算机3只能使用ActionName运行,而只有一台计算机只能运行ControllerName/ActionName 。 可能有什么问题? 谢谢你的时间。 编辑1:即使第一个答案仍然有同样的问题。 请参阅评论。

如何从jquery .load获取php respone

我给另一个代码例如这是我的some3.php代码:(第一个文件): $(document).ready(function(){ $(‘p’).click(function(){ var who = $(‘input#who’).val(); var why = $(‘input#why’).val(); $(‘#geting’).load(‘file2.php’,{who:who,why:why},function(applyData){ if ( applyData == ‘YEY . Ye have hi’ ){ alert(‘OKKK data is ok ‘); } else{ alert(‘Nooo We dont have requested output’); } }); }); }); click 我这是我的file2.php: 它不起作用为什么? 我们有回声“1”和echo“2”我希望jquery只检查$ myVariable数据不是整个php回调! 我想我必须使用json,但我不知道如何

jQuery.post()如何处理Content-Disposition:attachment?

在这里略显疯狂。 我正在使用jQuery.post进行Ajax调用,如下所示: $.post(‘php/print.php’,{data:dS},function(res){… },”text”); 我从print.php返回(作为测试): header(“Content-type: application/vnd.ms-word”); header(“Content-Disposition: attachment;Filename=test.doc”); echo “”; echo “”; echo “”; echo “Testing-2-3!”; echo “”; echo “”; 根据Firebug,包括标题在内的数据很好。 但是如何让浏览器(在本例中为Firefox)提示用户保存附件? 谢谢。

ajax发布不发送数据

更新:我想出来了。 是一个URL问题,它在发送到服务器之前重定向并清除了POST。 $(‘#addbtn’).on(‘click’,function() { $.ajax({ type: “POST”, url: “/create/”, dataType: “json”, data: $(‘#MultiAdd’).serializeArray(), success: function (data) { // this returns Failed. Please Try Again. c_name= // c_name should equal the value from post. alert(data.msg) }, error: function (xhr, ajaxOptions, thrownError) {} }); }); 我似乎无法通过发布数据。 我尝试了很多变化。 看了几个小时试图看错了什么。 我试过data: {test:’test’} (没用) GETfunction可以,但我需要这个POST。 我也尝试过普通的.serialize()。 仍然没有工作。 这确实可以向我展示价值观。 但是ajax不会在提交中发布它们。 console.log($(‘#MultiAdd’).serializeArray()); […]

Javascript POST无法正常工作 – 将Javascript数组发送到PHP

我知道在SO和网络上有一些关于此的条目,但是我无法开始工作 – 任何帮助都将不胜感激。 所以我在Javascript中有一个数组,我正在尝试传递给PHP。 我有一个小的JS函数来首先发布它,所以: function sendToPHP() { $.post(“index.php”, { “variable”: toSearchArray }); } 然后在页面下面,我有PHP: *印刷品就在那里供我检查。 任何想法 – 我在使用MAMP所以它的localhost:8888 / index.php。 这可能导致URL不正确的问题吗? 谢谢。