Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JQuery每个循环使用字符串concat this.text_Jquery_Get_Concatenation_Each - Fatal编程技术网

JQuery每个循环使用字符串concat this.text

JQuery每个循环使用字符串concat this.text,jquery,get,concatenation,each,Jquery,Get,Concatenation,Each,我有一个each循环,它应该发送一条私人消息: [...].each(function () { $.get('board.php?func=list&id=' + (this.text) + '&send=Please read the board rules'); }); 当我做“提醒(这个.文本);”在每个循环中,一切正常。但当我把它和get请求的字符串连接起来时,它就不起作用了。 我错过了什么吗?也许用$写得更详细一点。ajax让您更清楚为什么需要使用$(this.te

我有一个each循环,它应该发送一条私人消息:

[...].each(function () { $.get('board.php?func=list&id=' + (this.text) + '&send=Please read the board rules'); });
当我做“提醒(这个.文本);”在每个循环中,一切正常。但当我把它和get请求的字符串连接起来时,它就不起作用了。
我错过了什么吗?

也许用$写得更详细一点。ajax让您更清楚为什么需要使用
$(this.text()
,而不是
this.text

$(data from get request).find('#boardmembers')
                        .children('members')
                        .each(function() { 
                             $.ajax({
                                 type: 'GET',
                                 url : 'board.php',
                                 data: {
                                        func:'list',
                                        id  : $(this).text(),
                                        send: 'Please read the board rules'
                                 }
                             });
                        });

这个
到底是什么,告诉我们它的使用范围?如果它是一个元素,它可能应该是
$(this).text()
尝试单独定义url并记录它以查看错误所在,例如
[…]@adeneo:我正在处理的数据来自另一个get请求。我现在正在使用回调函数:$(来自get请求的数据)。查找('#boardmembers')。子对象('members')。每个[…]。其余的在上面;)然后您使用元素,在每个()中
这个
将是一个本机DOM元素,它没有
文本
属性,您应该使用
$(this).text()
来获取文本,您尝试过了吗。以后我将只使用这个样式。帮助很大。谢谢你,伙计!