Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.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
Javascript jQuery$.post type错误:e.type不是函数_Javascript_Jquery_Forum - Fatal编程技术网

Javascript jQuery$.post type错误:e.type不是函数

Javascript jQuery$.post type错误:e.type不是函数,javascript,jquery,forum,Javascript,Jquery,Forum,我正在尝试为ZetaBoards论坛软件构建一个反馈脚本,我创建了一个$.post函数,当我尝试通过单击submit按钮提交表单时,它只在Firebug中返回“TypeError:e.type不是函数” 这是我的密码: <script type="text/javascript"> var forumID = '1701794'; if (location.href.indexOf('/profile/') !== -1) { $('table.pr

我正在尝试为ZetaBoards论坛软件构建一个反馈脚本,我创建了一个$.post函数,当我尝试通过单击submit按钮提交表单时,它只在Firebug中返回“TypeError:e.type不是函数”

这是我的密码:

<script type="text/javascript">
    var forumID = '1701794';

    if (location.href.indexOf('/profile/') !== -1) {
        $('table.profile:last').after('<form id="feedback_form"><table class="profile" id="feedback"><thead><tr><th colspan="4">Feedback</th></tr></thead><tbody><tr><th colspan="4">Overall Rating: # (Positive: #, Neutral: #, Negative: #)</th></tr><tr><td colspan="4">Submit feedback: <input type="text" name="comment" size="100" /> <input type="radio" name="feed_rate" value="3">0 <input type="radio" name="feed_rate" value="1">1 <input type="radio" name="feed_rate" value="2">2 <button type="button">Submit</button></td></tr><tr><th>Rating</th><th>Comment</th><th>From</th><th>Date</th></tr></tbody></table></form>');

        var profileID = window.location.href.split('profile/')[1].split('/')[0];

        $.get(main_url + 'forum/' + forumID + '/', function (data) {
            $('table.posts:not(#announcement_list) tr[class*="row"]', data).each(function () {
                var userID = $(this).find('td.c_cat-title a').text().split('~')[0];
                var rating = $(this).find('td.c_cat-title a').text().split('~')[1];
                var comment = $(this).find('div.description').text();
                var userHref = $(this).find('td.c_cat-starter a').attr('href');
                var userText = $(this).find('td.c_cat-starter a').text();
                var date = $(this).find('div.t_lastpostdate').text();

                if (profileID === userID) $('#feedback tbody').append('<tr><td>' + rating + '</td><td>' + comment + '</td><td><a href="' + userHref + '">' + userText + '</a></td><td>' + date + '</td></tr>');
            });
        });

        $('#feedback button').click(function () {
            var userID = window.location.href.split('profile/')[1].split('/')[0];
            var description = $('input[name="comment"]').val();
            var rating = $('input[name="feed_rate"]:checked').val();
            var title = userID + '~' + rating;

            $.get(main_url + 'post/?type=1&mode=1&f=' + forumID, function (data) {
                var ast = $('input[name="ast"]', data).val();
                var xc = $('input[name="xc"]', data).val();

                $.post(main_url + 'post/', $.extend({
                    mode: 1,
                    type: 1,
                    ast: ast,
                    f: forumID,
                    xc: xc,
                    sd: 1,
                    title: title,
                    description: description,
                    post: description + '~' + title
                }));
            });
        });
    }
</script>

var forumID='1701794';
if(location.href.indexOf('/profile/')!=-1){
$('table.profile:last')。之后('feedback总体评分:#(正面:#,中性:#,负面:#)提交反馈:0 1 2提交评论FromDate');
var profileID=window.location.href.split('profile/')[1]。split('/')[0];
$.get(main_url+'forum/'+forumID+'/',函数(数据){
$('table.posts:not(#announcement_list)tr[class*=“row”]”,data)。每个(函数(){
var userID=$(this).find('td.c_cat-title a').text().split('~')[0];
var rating=$(this).find('td.c_cat-title a').text().split('~')[1];
var comment=$(this.find('div.description').text();
var userHref=$(this).find('td.c_cat-starter a').attr('href');
var userText=$(this).find('td.c_cat-starter a').text();
var date=$(this.find('div.t_lastpostdate').text();
if(profileID==userID)$(“#feedback tbody”).append(“”+评级+“”+评论+“”+日期+“”);
});
});
$(“#反馈按钮”)。单击(函数(){
var userID=window.location.href.split('profile/')[1]。split('/')[0];
var description=$('input[name=“comment”]).val();
var评级=$('input[name=“feed_rate”]:checked').val();
var title=userID+'~'+评级;
$.get(main_url+'post/?type=1&mode=1&f='+forumID,函数(数据){
var ast=$('input[name=“ast”]”,data.val();
var xc=$('input[name=“xc”]”,data.val();
$.post(主url+'post/',$.extend({
方式:1,,
类型:1,
ast:ast,
f:福鲁米德,
xc:xc,
sd:1,
标题:标题,,
描述:描述,
帖子:description+'~'+标题
}));
});
});
}
下面是我使用它的地方:

使用测试帐户登录:

用户名:Test


密码:Test1

您正在覆盖jQuery内置函数
$。键入值为1的
。 在$.post调用中,
$.extend({})
的目的是什么?这就是导致错误的原因

将其替换为以下内容:

$.post(main_url + 'post/', {
      mode: 1,
      type: 1,
      ast: ast,
      f: forumID,
      xc: xc,
      sd: 1,
      title: title,
      description: description,
      post: description + '~' + title
});

不使用第二个参数调用将覆盖jQuery对象的默认属性。

您确定用户名和密码不是小写的吗?你真的希望人们登录到你的网站,在论坛脚本中到处乱动来发现错误吗?$.post中的
type
参数,为什么需要在$.extend()中?我上面发布的用户名和密码是正确的,测试帐户可以让人们提交表单并自己查看错误。我认为这就是错误所在,它取代了jQuery内置函数
$.type()
。你是说我不应该使用$.extend,因为使用它会将“type”视为$.type()?这里有一个脚本,它使用类似的函数,并且似乎可以工作:+1-我发现了同样的事情。这绝对是个严重的问题。