如何从angularjs $ HTTP发送点字符作为参数 [英] How to send dot character as a parameter from angularjs $http

查看:114
本文介绍了如何从angularjs $ HTTP发送点字符作为参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图发送(点)作为字符串中的的NodeJS以下ASPI调用。
我使用Angularjs $ HTTP 对象。

I am trying to send . (dot) as a string to the following aspi call in Nodejs. I am using Angularjs $http object.

我可以看到呼叫正在与我在搜索框中输入点(。)字符的。

I can see that the call is being made with the dot (.) character that I have entered in the search box.

的https://本地主机:3003 /职位/搜索/

然而,当我看到通过谷歌的开发工具Ajax调用,它是拨打电话为:

However, when I see the ajax call through google developer tool, it is making a call as:

的https://本地主机:3003 /职位/搜索/

我如何传递一个点字符?

How can I pass a dot character?

code是:

收益

$http.get('https://localhost:3003/posts/search/.').then(getPostCompleted).catch(function (message) {
                handleException(message);
            });

我不认为我有BTOA或本ATOB?

I don't think I have to btoa or atob on this?

谢谢
上午

推荐答案

请参阅的这个中有关使用一个点。

See this about using a dot.

如果你想使用GET,那么你可以传递参数作为查询字符串即

If you want to use GET then you could pass the parameter as a query string i.e

$http.get('https://localhost:3003/posts/search?string=.')
.then(getPostCompleted).catch(function (message) {
    handleException(message);
});

否则,你可以使用POST和参数添加到身体

Otherwise you can use POST and add the parameter to the body

$http.post('https://localhost:3003/posts/search', {string: '.'})
.then(getPostCompleted).catch(function (message) {
    handleException(message);
});

这篇关于如何从angularjs $ HTTP发送点字符作为参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆