小编Kim*_*rlo的帖子

AngularJS和JQuery $ .each()函数只返回最后一个循环值

我一直在使用AngularJS并在我的项目中集成了JQuery库.

我正在使用JQuery的$.each()函数来遍历我的类.我想从中创建一个对象数组,就像下面的格式一样:

[
    {"invoice_no":"value1", "brand":"value2", "model":"value3"},
    {"invoice_no":"value1", "brand":"value2", "model":"value3"},
    {"invoice_no":"value1", "brand":"value2", "model":"value3"},
    {"invoice_no":"value1", "brand":"value2", "model":"value3"},
    {"invoice_no":"value1", "brand":"value2", "model":"value3"},
]
Run Code Online (Sandbox Code Playgroud)

HTML

<div class="panels">
   <input class="form-control" name="invoice_no">
   <input class="form-control" name="brand">
   <input class="form-control" name="model">
</div>
<div class="panels">
   <input class="form-control" name="invoice_no">
   <input class="form-control" name="brand">
   <input class="form-control" name="model">
</div>
<div class="panels">
   <input class="form-control" name="invoice_no">
   <input class="form-control" name="brand">
   <input class="form-control" name="model">
</div>
<div class="panels">
   <input class="form-control" name="invoice_no">
   <input class="form-control" name="brand">
   <input class="form-control" name="model">
</div>
<div class="panels">
   <input class="form-control" name="invoice_no">
   <input class="form-control" name="brand">
   <input class="form-control" …
Run Code Online (Sandbox Code Playgroud)

javascript jquery angularjs

5
推荐指数
1
解决办法
465
查看次数

Paypal API Express 结账错误:文档已准备好,元素 [object Object] 不存在

我正在使用贝宝,我需要在我的表格中呈现多个贝宝快速结帐按钮。

\n\n

我遵循了在此链接中找到的解决方案

\n\n

这就是我所做的。

\n\n
  document.querySelectorAll(\'.btn-paypal\').forEach(function(){\n    var dis = $(this);\n    var amount = dis.data(\'amount\');\n\n    paypal.Button.render({\n\n        env: \'sandbox\', \n\n        style: {\n            label: \'checkout\',\n            size:  \'medium\',    // small | medium | large | responsive\n            shape: \'rect\',     // pill | rect\n            color: \'gold\'      // gold | blue | silver | black\n        },\n\n        client: {\n            sandbox:    \'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-w6Q9rX2BdH1\',\n            production: \'<insert production client id>\'\n        },\n\n        payment: function(data, actions) {\n            return actions.payment.create({\n                 payment: {\n                    transactions: [\n                        {\n                            amount: { total: amount, currency: \'JPY\' }\n                        }\n …
Run Code Online (Sandbox Code Playgroud)

javascript jquery paypal

5
推荐指数
1
解决办法
7151
查看次数

将删除按钮添加到附加元素

我的代码附在下面.

$('#aprod').on('click', function() {
    $('#ln1').clone().appendTo('#page3_inside');
    prodnum = prodnum + 1;
    $('#conf_prodnum').val(prodnum);
});

$('body').on('click', '.del', function() {
 	$(this).closest('tr').remove();
});
Run Code Online (Sandbox Code Playgroud)
<html>
<head>
    <meta name="generator"
    content="HTML Tidy for HTML5 (experimental) for Windows https://github.com/w3c/tidy-html5/tree/c63cc39" />
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <title></title>
</head>
<body>
    <form>
        <input type='button' value='Add Another Product' id='aprod' />
    </form>
    <table id='page3_inside'>
        <tr id='ln1'>
            <td>
                <label for="product_name">Product Name</label>
                <br />
                <select class='input name_of_product' style='width:150px; height:34px;' name="name_of_product[]">
                    <option value="">Select from List</option>
                </select>
            </td>
            <td>
                <label for="product_cat">Product Category</label>
                <br />
                <input type='text' class="input product_category" name="product_category[]"
                style="font-family:verdana; width:150px; …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

4
推荐指数
1
解决办法
97
查看次数

PayPal Smart Payment Buttons 错误 paypal.Buttons is not a function

我正在我的网站中集成智能支付按钮,在它正常工作之前,但今天早些时候,我收到了这些错误

在此处输入图片说明

我什至在加载文件中的paypal.Buttons().render()函数之前加载了 paypal SDKpaypal.js

<script src="https://www.paypal.com/sdk/js?client-id=<MY_CLIENT_ID_HERE>&currency=PHP"></script>

<script type="text/javascript" src="paypal.js"></script>
Run Code Online (Sandbox Code Playgroud)

这是我paypal.js文件的内容

paypal.Buttons({
createOrder : function(data, actions){
  return actions.order.create({
    purchase_units : [{
      amount : {
        value : amount_to_pay
      }
    }],
    application_context: {
        shipping_preference: "NO_SHIPPING",
    },
    country_code : "PH"
  })
},
style: {
      color:  'gold',
      shape:  'rect',
      label:  'buynow',
       size: 'responsive',
       branding: true

  },
  onApprove: function(data, actions) {
    // Capture the funds from the transaction
    return actions.order.capture().then(function(details) {

      return fetch('/pay-with-pp', {
        method: 'post',
        headers: {
          'content-type': 'application/json'
        }, …
Run Code Online (Sandbox Code Playgroud)

php paypal

3
推荐指数
1
解决办法
4856
查看次数

通过 LAN 从其他 PC 访问 xampp 服务器

我刚刚下载了最新的 XAMPP 版本并将其安装在我的新电脑上。但是我无法从 LAN 上的另一台 PC 通过浏览器(Google Chrome)访问本地网络服务器。

我允许 MySQL 和 Apache 通过我的防火墙。在我的服务器 PC 上设置静态 IP。(192.168.1.130)我还更改了httpd.conf文件的配置

<Directory />
   AllowOverride none
   Require all denied
</Directory>
Run Code Online (Sandbox Code Playgroud)

<Directory />
   AllowOverride All
   Require all denied
</Directory>
Run Code Online (Sandbox Code Playgroud)

然后我重新启动apache..仍然无法通过IP或计算机名访问它。

php apache

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

警告:PHP启动:无法加载动态库

我目前正在1und1.de上托管。我的代码在localhost上运行,但是将其上传到共享托管服务器上时,出现以下错误:

Warning: Unknown: open(C:\xampp\tmp/sess_bnt91ftgq6s4obn2684fud47p5, O_RDWR) failed: No such file or directory (2) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\xampp\tmp) in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_bz2.dll' - C:\xampp\php\ext/php_bz2.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_curl.dll' - C:\xampp\php\ext/php_curl.dll: cannot open …
Run Code Online (Sandbox Code Playgroud)

php

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

使用 jQuery 打开链接并自动滚动到特定的 div

我有这个代码,当你打开一个链接时,它会滚动到该页面上的特定 div。

集合.html

<a id='about' href="index.html">about</a>
Run Code Online (Sandbox Code Playgroud)

索引.html

<div id='#moreInfo>contents here</div>

<script>
   $(document).ready(function(){
          $('html, body').animate({
             scrollTop: $("#moreInfo").offset().top
           }, 1000);
   })
</script>
Run Code Online (Sandbox Code Playgroud)

我的问题是每当我加载index.html 时,它总是滚动到moreInfo div。我想要的是当我在collection.html 上并单击about链接时,它将重定向到index.html然后平滑滚动到moreInfo div。

我会很感激任何答案。

html javascript jquery autoscroll

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

LARAVEL 5.4:ValidatePostSize.php中的PostTooLargeException(第24行)

我目前正在使用Laravel 5.4开发应用程序.我正在使用xampp并使用以下配置更改了php.ini,php.ini-development和php.ini-production文件

post_max_size = 100M

upload_max_filesize = 200M

memory_limit = 128M

我重新启动了Apache和我的laravel开发服务器,但仍然,我得到了错误

Warning: POST Content-Length of 14253688 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

PostTooLargeException in ValidatePostSize.php (line 24)

我甚至重新启动了我的电脑,但仍然没有工作.我在这里错过了什么吗?

谢谢

php laravel-5

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

在javascript中更改警告框的语言

我有一个警告框,每当显示两个或更多警告框时,它会显示消息"防止此页面创建其他对话框".我想将其语言改为德语,我该怎么做?

<script>
  alert('All fields are required!');
</script>
Run Code Online (Sandbox Code Playgroud)

javascript

-2
推荐指数
1
解决办法
936
查看次数

标签 统计

javascript ×5

jquery ×4

php ×4

html ×2

paypal ×2

angularjs ×1

apache ×1

autoscroll ×1

laravel-5 ×1