在ajax帖子上用javascript发送文字日期
我已获得一个可以使用的网络服务,该服务将之前和之后的两个日期作为字符串,我无法更改该网络服务。
当我在浏览器中输入该网址时,该网址有效,但当我尝试在代码中输入它时,它会发送一个 + 而不是空格和冒号的十六进制值。
我的代码如下:
var t = new Date(2011, 05, 11, 00, 00, 00);
var a = "" + t.getFullYear() + "-" + t.getMonth() + "-" + t.getDate() + " 0" + t.getHours() + ":0" + t.getMinutes() + ":0" + t.getSeconds();
$.getJSON("http://somedomain/restserver.aspx?&callback=?",
{
method: "date",
after: a,
before: a,
format: "xml"
},
function(json) {
alert("success");
});
有没有办法按字面意思发送空格和冒号。
任何对此的帮助将不胜感激,谢谢
Im have been given a web service to use that takes two dates for before and after as strings, I cannot change the web service.
The url works when i enter it in the browser but when I try entering it in code it sends a + instead of the space and the hex values for the colons.
my code goes as follows:
var t = new Date(2011, 05, 11, 00, 00, 00);
var a = "" + t.getFullYear() + "-" + t.getMonth() + "-" + t.getDate() + " 0" + t.getHours() + ":0" + t.getMinutes() + ":0" + t.getSeconds();
$.getJSON("http://somedomain/restserver.aspx?&callback=?",
{
method: "date",
after: a,
before: a,
format: "xml"
},
function(json) {
alert("success");
});
It is trying to send:
http://somedomain/restserver.aspx?&callback=?&method=date&after=2011-5-11+00%3A00%3A00&before=2011-5-11%252023%253a59%3A00&format=xml
Is there a way to send a space and a colon literally.
Any help with this would be much appreciated thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试做
Try doing