小编Fél*_*ier的帖子

Woocommerce - 产品页面 - 如何在"添加到购物车"按钮上创建AJAX?

我想在可以使用AJAX的产品页面上创建一个"添加到购物车"按钮.我该怎么做?当我在产品页面上添加到购物车时 - 它会刷新页面,我如何通过AJAX使其工作?

存档上"快速浏览"中的"添加到购物车"按钮由ajax工作 - 这很棒,但我怎么能在产品页面上做同样的事情?

我想点击产品页面上的"带我回家",然后通过ajax将带有所选属性的产品添加到我的购物车中并打开该购物车(就像当你将鼠标悬停在菜单上的包图像上)并摇动包图片.

php ajax wordpress woocommerce

14
推荐指数
4
解决办法
6万
查看次数

将目录文件夹名称存储到阵列Powershell中

我正在尝试编写一个脚本,它将获取特定目录中所有文件夹的名称,然后将每个文件夹作为数组中的条目返回.从这里开始,我将使用每个数组元素来运行一个更大的循环,该循环使用每个元素作为稍后函数调用的参数.所有这一切都是通过powershell进行的.

目前我有这个代码:

function Get-Directorys
{
    $path = gci \\QNAP\wpbackup\

    foreach ($item.name in $path)
    {
        $a = $item.name
    }
}   
Run Code Online (Sandbox Code Playgroud)

$ path行是正确的并且获取了所有目录,但foreach循环是它实际存储第一个目录的各个字符而不是每个directorys全名到每个元素的问题.我已经对Powershell如何创建数组做了一些研究,但我有点困惑,所以我希望有人能指出我正确的方向.

谢谢你的帮助.

arrays directory powershell

13
推荐指数
4
解决办法
6万
查看次数

对活动目录进行ajax调用,并使用post提取缩略图照片

我想使用post从活动目录中检索信息(例如缩略图).

<?php
/**
 * Get a list of users from Active Directory.
 */
$ldap_password = $_POST['password'];
$ldap_username = $_POST['username'];
$server = 'ldap://xxxxxxxxxxxxxxxxxxxxxx';
$domain = 'xxxxxxxxxxxxxxxxx';
$port       = 389;
$ldap_connection = ldap_connect($server, $port);

if (FALSE === $ldap_connection){
    // Uh-oh, something is wrong...
}

// We have to set this option for the version of Active Directory we are using.
ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3) or die('Unable to set LDAP protocol version');
ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, 0); // We need this for doing an LDAP search. …
Run Code Online (Sandbox Code Playgroud)

javascript php ajax jquery

13
推荐指数
2
解决办法
1535
查看次数

QScintilla中的色素

考虑这个mcve:

import math
import sys
import textwrap
import time
from pathlib import Path
from collections import defaultdict

from PyQt5.Qsci import QsciLexerCustom, QsciScintilla
from PyQt5.Qt import *

from pygments import lexers, styles, highlight, formatters
from pygments.lexer import Error, RegexLexer, Text, _TokenType
from pygments.style import Style


EXTRA_STYLES = {
    "monokai": {
        "background": "#272822",
        "caret": "#F8F8F0",
        "foreground": "#F8F8F2",
        "invisibles": "#F8F8F259",
        "lineHighlight": "#3E3D32",
        "selection": "#49483E",
        "findHighlight": "#FFE792",
        "findHighlightForeground": "#000000",
        "selectionBorder": "#222218",
        "activeGuide": "#9D550FB0",
        "misspelling": "#F92672",
        "bracketsForeground": "#F8F8F2A5",
        "bracketsOptions": "underline",
        "bracketContentsForeground": "#F8F8F2A5",
        "bracketContentsOptions": "underline",
        "tagsOptions": …
Run Code Online (Sandbox Code Playgroud)

python scintilla pygments qscintilla pyqt5

12
推荐指数
1
解决办法
1920
查看次数

在OpenLayers中查找点的坐标

如何在OpenLayers中获取地图上特定点的坐标?

gis openlayers

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

C3P0配置!在哪里和如何?

我们正在使用JPA2.0和Hibernate3.0实现Web应用程序.连接池配置在位于META-INF文件夹中的persistence.xml中设置.


persistence.xml中:

<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
    <persistence-unit name="MyPU" transaction-type="RESOURCE_LOCAL">
        <!-- Entity Classes-->
        <properties>
            <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
            <property name="hibernate.show_sql" value="true"/>
            <property name="bytecode.provider"   value="org.hibernate.bytecode.javassist.BytecodeProviderImpl"/>
            <property name="hibernate.connection.username" value="{username}"/>
            <property name="hibernate.connection.password" value="{password}"/>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
            <property name="hibernate.format_sql" value="true"/>
            <property name="hibernate.connection.url" value="{jdbc url}"/>

            <property name="hibernate.c3p0.min_size" value="1"/>
            <property name="hibernate.c3p0.timeout" value="1000"/>
            <property name="hibernate.c3p0.acquire_increment" value="1"/>
            <property name="hibernate.c3p0.idle_test_periods" value="600"/>
            <property name="hibernate.c3p0.testConnectionOnCheckin" value="true"/>
            <property name="hibernate.c3p0.preferredTestQuery" value="SELECT 1;"/>
       </properties>
    </persistence-unit>
</persistence>
Run Code Online (Sandbox Code Playgroud)

我们遇到连接池配置问题.似乎配置没有效果,连接将在8小时后中断.我们需要另一个配置文件,如hibernate.cfg.xml或hibernate.properties吗?

欢迎任何帮助.

java hibernate connection-pooling c3p0 jpa-2.0

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

如何在没有AM/PM的情况下使用datetime-local?

我想使用以下代码:

<input type="datetime-local" name="date" value="" />
Run Code Online (Sandbox Code Playgroud)

并希望它没有AM/PM(24小时).有任何想法吗?

谢谢,

达纳

html input

11
推荐指数
1
解决办法
1万
查看次数

在没有通知有效负载的情况下在Android和iOS上使用GCM

我想通过Google Cloud Messaging在Android和iOS上实现推送通知.

我不想notification在我的有效负载中使用密钥,因为Android行为并不理想.在Android上,我更喜欢我的接收器总是被data有效载荷触发,我可以用Notification自己构建自己NotificationCompat.例如,如果您notification在Android上使用有效负载,则无法控制通知样式.

但是,如果我只发送一个data有效载荷,我想我的iOS应用程序将不会接收推送,如果它是背景 - 杀死,从设备重启后从未启动等等.我认为content_availableGCM 的那个标志可能会触发推送?

在iOS上,我是否能够复制Android行为,始终在通知后执行我的应用内代码?我可以根据GCM data有效负载构建我自己的iOS通知,并且可能使用类似的东西UILocalNotification,但从我正在阅读的内容来看,iOS要求notification有效负载存在以确保用户始终接收推送.

我能在iOS上获得这种控制吗?

notifications android ios google-cloud-messaging

11
推荐指数
1
解决办法
584
查看次数

按Enter键进入文本框后,防止模糊和键盘事件触发

按下之后enter我希望只有keyup事件被触发但是先blur被解雇.怎么取消blur什么时候keyup解雇enter

请不要建议结合两者blurkeyup成一个单一的live()方法.

$(".textbox").on("blur",function () { 
    alert("blur Event fired");
});

$(".textbox").on("keyup",function (event) { 
    if(event.keyCode == 13){ // Detect Enter
        alert("KeyUp fired after pressing Enter");
    }
});
Run Code Online (Sandbox Code Playgroud)

javascript jquery

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

时间戳检查是否超过12小时

如何检查时间戳是否超过12小时?

我需要让链接工作12个小时,之后我需要显示一条错误消息.

php timestamp

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