我有FB JS SDK的问题.
我正在尝试获取facebook页面节点的fan_count.
这是我的html文件到我体内的代码:
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'your-app-id',
xfbml : true,
version : 'v2.5'
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
Run Code Online (Sandbox Code Playgroud)
当我在我的js应用程序上使用它时,我使用它:
init();
function init() {
var id_fb = "l214.animaux";
while (true) {
console.log("je suis ici");
FB.api(
'/' + id_fb + '/',
'GET',
{"fields":"fan_count"},
function(response) {
alert(response.fan_count);
}
);
}
}
Run Code Online (Sandbox Code Playgroud)
但错误是FB没有定义.有什么建议 ?
javascript facebook facebook-graph-api facebook-javascript-sdk
我正在寻找一种使用 WSDL 向 Web 服务发送 SOAP 请求的方法。使用 Typescript 2 和 Angular 2 可以做到这一点吗?
我看过 Angular 1 的教程,但他们使用了旧的角度方法,例如factory或controller。
如果可能的话,我希望有一种使用 TypeScript 来实现这一点的新方法。
有任何想法吗 ?
我有一个编辑器,可以在其中选择文本并通过以下代码显示它:
alert(tinyMCE.activeEditor.selection.getContent({format : "html"}));
Run Code Online (Sandbox Code Playgroud)
问题是该函数仅返回文本而不返回 HtmlElement。因此,我看不到封装此选定文本的节点。我想获取内容,但通过 HtmlElement 来处理节点。
有什么建议 ?
我在C++ 11中遇到了一些困难.我想创建函数isSorted,如果我std::forward_list已经排序则返回true,否则返回false.
我想象过这样的代码:
template<class T>
bool estTriee(forward_list<T>& list) {
typename forward_list<T>::iterator it;
it = list.begin();
while(it != list.end() && *it <= *next(it, 1)) {
it++;
}
return it == list.end();
}
Run Code Online (Sandbox Code Playgroud)
但是gcc会给我一个围绕while行的分段错误.
如何从中调用我的一个Component函数onreadystatechange(因为它不能识别this为我的类而是as xmlhttpelement)
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
this.anotherFunction(xmlhttp); //this is considered as xmlhttp instead of my class which contains this function
}
}
Run Code Online (Sandbox Code Playgroud) POST我正在尝试使用 javascript 中的方法发送 xmlXmlHttpRequest object.
On my server I've a web service which receives SOAP request.
OPTIONS当我想发送 xml 时,浏览器之前尝试向服务器发送预检请求,但它返回OPTIONS 405 Method Not Allowed.
问题是我的响应标头中有,Access-Control-Method-Allowed : POST,OPTIONS,GET,PUT所以我猜我的服务器接受 OPTIONS 方法,但我的 Web 服务只理解POST请求。
这是一些代码:
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST', url, false);
var sr = mySoapRequest; //Here's my XML
xmlhttp.onreadystatechange = () => {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var xml = xmlhttp.responseXML;
console.log(xml);
this.showAlert(xml);
}
}
}
xmlhttp.setRequestHeader("content-type", …Run Code Online (Sandbox Code Playgroud) 我想知道为什么我的分配有效。我创建了ptr哪个是一个指针,ptr2哪个是与ptr.
这是我的代码:
int* ptr = malloc(sizeof(int));
int* ptr2 = ptr;
*ptr2 = 1;
ptr2 = ptr+1;
*ptr2 = 2;
Run Code Online (Sandbox Code Playgroud)
最后,我有一个由两个整数组成的数组:
ptr[0] = 1
ptr[1] = 2
Run Code Online (Sandbox Code Playgroud)
我的问题是:为什么我可以在ptr2没有错误或警告的情况下影响值 2 ?我只malloc()为数组中的一个整数位置设置了 -ed,不是吗?
javascript ×3
angular ×2
soap ×2
typescript ×2
algorithm ×1
arrays ×1
c ×1
c++ ×1
c++11 ×1
cors ×1
facebook ×1
forward-list ×1
malloc ×1
soap-client ×1
sorting ×1
tinymce ×1
wildfly ×1