我想检查页面是否返回状态代码401.这可能吗?
这是我的尝试,但它只返回0.
$.ajax({
url: "http://my-ip/test/test.php",
data: {},
complete: function(xhr, statusText){
alert(xhr.status);
}
});
Run Code Online (Sandbox Code Playgroud) ajax jquery xmlhttprequest http-status-codes http-status-code-401
我正在尝试从我的本地网络服务器访问Active Directory.为此,我使用最新版本的xampp和一个名为adLDAP的PHP脚本.如果我理解正确,我需要启用SSL才能访问https网址.我试图谷歌但没有运气:(任何人都可以链接教程或向我解释如何在xampp/apache上为Windows 7 64位安装SSL?任何帮助将不胜感激:)
我在我的网站上包含了CKEditor.即使我收到这个JS错误,一切正常:
未捕获的异常:[CKEDITOR.editor]实例"simple_editor"已经存在.
下面的代码包含在PHP文件中,我在其中包含了我想要编辑器的位置.我每页只有一个编辑器实例.
<textarea class='ckeditor' id='simple_editor' name='simple_editor'>".$page_content."</textarea>";
<script type="text/javascript">
CKEDITOR.replace( 'simple_editor',
{
height: '110px',
toolbar :
[
['Link','Unlink'],
['Styles','Format','Font','FontSize'],
['Bold','Italic','Underline','Strike'],
['TextColor','BGColor'],
['NumberedList','BulletedList','Outdent','Indent']
]
});
</script>
Run Code Online (Sandbox Code Playgroud)
经过一些谷歌搜索后,我看到人们发布了一些有效的解决方案.
if (CKEDITOR.instances['simple_editor']) { delete CKEDITOR.instances['simple_editor'] };
if (CKEDITOR.instances['simple_editor']) { CKEDITOR.instances['simple_editor'].destroy(); }
Run Code Online (Sandbox Code Playgroud)
谁知道该怎么办?:S
如何从PHP中的Unix时间戳获取日期(1-7)?我还需要日期(1-31)和月份(1-12).
我有这个代码从mysql DB请求一些文件夹信息:
function gotoDir(pmcat_id, pcat_id){
$('#slideshowContainer').html('<img class="loader" src="/javascript/ajax-loader.gif">');
$.post("/publish/includes/content.includes/functions.slideshow.php",
{ updateSlideshowDir: 1, pmcat_id: pmcat_id, pcat_id: pcat_id },
function(data){
$('#pageSlideshow').html(data.content);
}, "json"
);
}
Run Code Online (Sandbox Code Playgroud)
有时,由于互联网连接不良,帖子请求超时.是否可以在$ .post()上设置超时检查?例如:如果$ .post()使用多于X ms,则重新加载请求.
更新:看起来我找到了一个解决方案:
function gotoDir(pmcat_id, pcat_id){
$('#slideshowContainer').html('<img class="loader" src="/javascript/ajax-loader.gif">');
$.ajax({
type:"post",
url:"/publish/includes/content.includes/functions.slideshow.php",
data: { updateSlideshowDir: 1, pmcat_id: pmcat_id, pcat_id: pcat_id },
dataType: "json",
success:function(data) {
if (data == null){
alert('ajax failed. reloading...');
gotoDir(pmcat_id, pcat_id);
} else {
$('#pageSlideshow').html(data.content);
}
}
});
}
Run Code Online (Sandbox Code Playgroud)
这是一个可行的方法吗?:S
我有这两个组成部分:
import { findDOMNode } from 'react-dom';
class Items extends Component {
constructor(props) {
super(props);
this.ref = React.createRef();
this.selectedItemRef = React.createRef();
}
componentDidMount() {
if (this.props.selectedItem) {
this.scrollToItem();
}
}
componentWillReceiveProps(nextProps) {
if (this.props.selectedItem !== nextProps.selectedItem) {
this.scrollToItem();
}
}
scrollToItem() {
const itemsRef = this.ref.current;
const itemRef = findDOMNode(this.selectedItemRef.current);
// Do scroll stuff here
}
render() {
return (
<div ref={this.ref}>
{this.props.items.map((item, index) => {
const itemProps = {
onClick: () => this.props.setSelectedItem(item.id)
};
if (item.id === this.props.selectedItem) { …Run Code Online (Sandbox Code Playgroud) 我对markItUp!的预览功能有疑问.
在jquery.markitup.js里面我有这些设置:
previewTemplatePath:'~/templates/preview.php',
previewParserPath:'~/templates/preview.php',
previewParserVar:'data'
Run Code Online (Sandbox Code Playgroud)
我不知道如何处理previewParserPath和previewParserVar.是否可以使用PHP获取preview.php中markItUp发送的内容?
// preview.php
<body>
<!-- content -->
</body>
Run Code Online (Sandbox Code Playgroud) 正如您在下面看到的,当我对安全组进行LDAP搜索时,我没有收到任何用户信息.我想用来$_SERVER[remote_user]检查用户是否是该组的成员.我还想检索该用户的信息并用它更新sql数据库.这可能吗?
$dn = "CN=Intra,OU=Common Security Groups,DC=mydomain,DC=local";
$filter = "(member=*)";
$ad = ldap_connect("IP") or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
$bd = ldap_bind( $ad, "username@mydomain.local", "password") or die("Can't bind to server.");
$sr = ldap_search($ad,$dn,$filter);
$entries = ldap_get_entries($ad, $sr);
Run Code Online (Sandbox Code Playgroud)
print_r($entries);
返回此:
Array
(
[count] => 1
[0] => Array
(
[objectclass] => Array
(
[count] => 2
[0] => top
[1] => group
)
[0] => objectclass
[cn] => Array
(
[count] => 1
[0] => Intra
)
[1] …Run Code Online (Sandbox Code Playgroud) 我使用CS4已有一年以上,没有任何问题。今天,我安装了Dreamweaver CS5,但是……我无法完成我的工作,因为它一直崩溃。当我尝试打开某些文件(在这种情况下:index.php)时,它崩溃。
在取消选中服务器设置中的“使用备用FTP移动方法”选项之前,“上传时保存”选项也存在问题。
我已经尝试过搜索该问题,但没有运气。有谁知道解决方案吗?
更新:
测试index.php中的每一行代码后,我终于找到了问题的根源。如果我将此行添加到文件中:
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Reenie+Beanie">
Run Code Online (Sandbox Code Playgroud)
Dreamweaver CS5停止工作。装有CS5的人可以尝试吗?
我有这个jQuery代码:
$(".right_box_holder").sortable({
update : function () {
var order = $('.right_box_holder').sortable('serialize');
$.get("right_menu_functions.php?change_sortorder&"+order);
}
});
Run Code Online (Sandbox Code Playgroud)
这个HTML代码:
<div class='right_box_holder'>
<div class='right_box' id='box_0'>
// sort box 0
</div>
<div class='right_box' id='box_1'>
// sort box 1
</div>
<div class='right_box' id='box_2'>
// sort box 2
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
就像现在一样,我可以点击.right_box内的任何地方并移动它.我想禁用它并在.right_box中创建一个按钮/图标,用户必须单击该按钮/图标才能拖动该框.这可能吗?