小编Rei*_*per的帖子

同一元素的jQuery对象不相等?

这一定是我忽略的东西,但是请看下面的页面和JavaScript并告诉我为什么,对于所有圣洁的东西,jQuery不会返回true?

HTML:http://alcatel.scottbuckingham.com/reporting/test.html

<p class="test">hello1</p>
Run Code Online (Sandbox Code Playgroud)

JS:http://alcatel.scottbuckingham.com/reporting/_scripts/collapse.js

;(function($, window, document, undefined) {

        var t = $('.test');
        var s = $('.test');

        console.log(t);
        console.log(s);

        if (t === s) {
            console.log('yes');
        }

})(jQuery, window, document);
Run Code Online (Sandbox Code Playgroud)

我花了好几个小时试图解决这个问题并将其减少到这个,几乎是1 === 1不起作用的声明.

任何帮助都非常感谢!

jquery

9
推荐指数
1
解决办法
5755
查看次数

邮递员表单数据有效,但原始等效数据不起作用

我有一个我正在测试的API,如果我通过"form-data"提交我的数据,它具有以下值:

key: response[comment]
value: This is a test
Run Code Online (Sandbox Code Playgroud)

但是如果我在"原始"选项卡中使用以下结构执行一些自定义JSON,则它不起作用:

{ "response[comment]": "This is a test" }
Run Code Online (Sandbox Code Playgroud)

说实话,这让我很疯狂,因为服务器没有给我任何有关错误的详细信息.我感觉这是对象的编码出错了,但我使用的是Angular,我得到了相同的400错误,而我很确定它应该只使用JS对象作为.post上的数据.

任何帮助,将不胜感激!

javascript api angularjs postman

5
推荐指数
2
解决办法
2万
查看次数

Zsh别名不起作用,但是在终端中粘贴时命令确实起作用

我的.zshrc文件中有一个别名,称为“管家”,如下所示:

alias housekeeping="git fetch -p && git branch -vv | grep ': gone]' | awk '{print $1}' | xargs git branch -d"
Run Code Online (Sandbox Code Playgroud)

当我运行此命令时,由于某种原因,我得到以下输出:

error: The branch '12795-add-ship-info-to-FAQ' is not fully merged.
If you are sure you want to delete it, run 'git branch -D 12795-add-ship-info-to-FAQ'.
error: branch '97167bb3f' not found.
error: branch '[origin/12795-add-ship-info-to-FAQ:' not found.
error: branch 'gone]' not found.
error: branch 'Edits' not found.
error: branch 'to' not found.
error: branch 'text' not found.
Run Code Online (Sandbox Code Playgroud)

看起来好像传递了错误的论点。

但是,当我直接从终端运行完全相同的命令时,确实得到了预期的结果。

我究竟做错了什么?

git bash zsh zshrc

0
推荐指数
1
解决办法
245
查看次数

标签 统计

angularjs ×1

api ×1

bash ×1

git ×1

javascript ×1

jquery ×1

postman ×1

zsh ×1

zshrc ×1