我正试图通过带有ajax的post将数据传递给我的sendjs.php.
jsonObj 没有在IE11中传递(没有测试IE的较低版本,但它适用于Edge和所有其他浏览器).FormData并且captchaResponse正在通过.
在IE 11检查器的"网络"中,帖子数据为:
cart: [null] 并且控制台中没有显示错误.
它包含所有其他浏览器的数据:
例如. cart: {name: "130 Litre Polypropylene Soakwells", price: "$39.95", quantity: "4", total: "$159.80"},…]
现场网站:www.diysoakwells.com.au(您可以添加项目和结帐以进行测试).
花了很多年才试图找到原因,现在我甚至不确定从哪里开始说实话,所以任何信息都会受到赞赏,我会根据要求更新帖子.
app.js
$(function() {
// Get the form.
var form = $("#ajax-contact");
// Get the messages div.
var formMessages = $("#form-messages");
var spinner = $("#spinner");
var submit = $("#submit");
// Set up an event listener for the contact form.
$(form).submit(function(e) {
// Stop the browser from submitting the form.
e.preventDefault();
//display …Run Code Online (Sandbox Code Playgroud) 我有一个由单选按钮组成的大型表单,我想用nunjucks动态创建.
我有一个带有数据的json文件,用变量填充每个html表单输入组.html包含每组两个无线电输入.
我可以从json文件中检索变量,但我仍然坚持创建FOR循环.
我想要实现的是循环遍历checklist.json中的每个子部分,并使用每个数组中的变量填充html列表,构建列表直到数据结束.
从html中可以看出,除了value之外,每个数组中的所有变量都在html输入块中使用了两次.
简介:只要有包含数组的子节,就迭代html表单输入并用每个数组中的对象填充每个输入.
index.njks
{% include "../includes/checklist-radio.njk" %}
Run Code Online (Sandbox Code Playgroud)
checklist.json(var = checklist_json)
{"checklist_title":"checklist variable test",
"checklist": [
{"section_title":"Responsive Design (Useability)",
"section":[
{"subsection_title1":"Mozilla Firefox Useability",
"subsection":[
{
"radio_title": "Mobile (Samsung S7 Edge)",
"name":"firefox_mobile",
"value": 1,
"class":"useability"
},
{
"radio_title": "Tablet (Surface Pro)",
"name":"firefox_tablet",
"value": 1,
"class":"useability"
},
{
"radio_title": "Desktop (Windows 10)",
"name":"firefox_desktop",
"value": 1,
"class":"useability"
}
]}
]}
]}
Run Code Online (Sandbox Code Playgroud)
清单-radio.njk
{% for checklist_json.checklist.section.subsection in checklist_json.checklist.section %}
<li>
<span class="radio_title">{{checklist_json.checklist.section.subsection.radio_title}}</span>
<label class="radio_label">
<input type="radio" class="radio {{checklist_json.checklist.section.subsection.class}}" name="{{checklist_json.checklist.section.subsection.name}}" value="{{checklist_json.checklist.section.subsection.value | …Run Code Online (Sandbox Code Playgroud) 当向下滚动时“middle_block2”到达“top_block”的底部时,我需要将“middle_block2”固定到固定位置“top_block”的底部或距窗口顶部85px(“top_block”的高度)。这是代码和 jsfiddle 的链接。
当它到达窗口顶部时我就让它工作了,但这是我所能达到的。
jsfiddle: https: //jsfiddle.net/jpolsonb/u9adhkc7/1/
超文本标记语言
<div class='top_block'>
<p>Top Block</p>
</div>
<div class='middle_block1'>
<p>Middle Block 1</p>
</div>
<div class ='ghost_div'>
<div class='middle_block2'>
<p>Middle Block 2</p>
</div>
</div>
<div class='bottom_block'>
<p>Bottom Block</p>
<p>Bottom Block</p>
<p>Bottom Block</p>
<p>Bottom Block</p>
<p>Bottom Block</p>
<p>Bottom Block</p>
<p>Bottom Block</p>
<p>Bottom Block</p>
<p>Bottom Block</p>
<p>Bottom Block</p>
<p>Bottom Block</p>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
* {
margin:0;
padding:0;
}
.top_block {
width:100%;
background-color: black;
height: 85px;
color:white;
padding: 0px;
margin: 0px;
position:fixed;
}
.middle_block1 {
width:100%;
background-color: yellow;
height: …Run Code Online (Sandbox Code Playgroud) 使用 node 和 npm 并作为 gitbash cli 的任务运行器。我已经设置并测试了,在大多数情况下一切正常。我遇到的问题是我似乎无法从 package.json 中调用单独的 .js 文件中的任务。请问我可以在语法方面提供一些帮助吗?
concat-css.js 与 package.json 位于同一文件夹中。
我的任务:
var concat = require('concatenate-files');
concat('deploy/css/min/*.css', 'deploy/css/css.css', { separator: ';' }, function(err, result) {
// result == { outputFile: 'out.js', outputData: '...' }
});
Run Code Online (Sandbox Code Playgroud)
package.json 中的脚本:
"scripts": {"concat-css": "npm run concat"}
Run Code Online (Sandbox Code Playgroud)
安装了依赖 concatenate-files 和本地和全局依赖:
"devDependencies": {"concatenate-files": "^0.1.1"}
"dependencies": {"concatenate-files": "^0.1.1"}
Run Code Online (Sandbox Code Playgroud)
但是当我运行任务时出现此错误:
npm run concat-css
npm ERR! missing script: concat
Run Code Online (Sandbox Code Playgroud)
老实说,我无法弄清楚出了什么问题,并且陷入了死胡同。npm 的在线资源有点零散。任何人都可以指出我正确的方向。标记的重复问题太笼统,对我没有帮助。
我已经按照这个(http://www.electrictoolbox.com/force-reload-css-javascript-unique-filenames/)教程强制更新缓存,方法是通过添加修改后的时间来动态命名我的css和javascript文件文件名.这是在开发期间使用,因为我的主机缓存我的文件服务器端有问题.我已经确认mod_rewrite已打开且正在读取htaccess,我肯定是在apache服务器上.我的脚本没有错误,但是当我使用开发人员工具检查源代码时,文件名没有改变.测试页面是www.diysoakwells.com.au/cart2.php.
的.htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^diysoakwells.com.au$
RewriteRule (.*) http://www.diysoakwells.com.au/$1 [R=301,L]
RewriteRule ^(css|js)/(.*)\.[0-9]+\.(.*)$ /$1/$2.$3 [L]
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
# Don’t compress
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
#Dealing with proxy servers
<IfModule mod_headers.c>
Header append Vary User-Agent
</IfModule>
</IfModule>
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
Run Code Online (Sandbox Code Playgroud)
PHP
<link rel="stylesheet" type="text/css" href="/css/styles2.1<?php echo filemtime('/css/styles2.1.css'); ?>.css" />
<script language="javascript" src="/js/simpleCart_verify<?php echo filemtime('/js/simpleCart_verify.js'); ?>.js"></script>
Run Code Online (Sandbox Code Playgroud)
我在评论中尝试了解决方案,但这一切对我来说都很好,有没有人有任何建议?谢谢.
我是如此接近,但只是不能到达那里.
我想在div中添加一个类display:none,如果它内部的跨度是空的.
HTML:
<div class="accordion-content default">
<div><span><?php the_field(''); ?></span><span><?php the_field('tenure1'); ?></span></div>
<div><span><?php the_field(''); ?></span><span><?php the_field('tenure2'); ?></span></div>
<div><span><?php the_field(''); ?></span><span><?php the_field('tenure3'); ?></span></div>
<div><span><?php the_field(''); ?></span><span><?php the_field('tenure4'); ?></span></div>
<div><span><?php the_field(''); ?></span><span><?php the_field('tenure5'); ?></span></div>
<div><span><?php the_field(''); ?></span><span><?php the_field('tenure6'); ?></span></div>
<div><span><?php the_field(''); ?></span><span><?php the_field('tenure7'); ?></span></div>
<div><span><?php the_field(''); ?></span><span><?php the_field('tenure8'); ?></span></div>
<div><span><?php the_field(''); ?></span><span><?php the_field('tenure9'); ?></span></div>
<div><span><?php the_field(''); ?></span><span><?php the_field('tenure10'); ?></span></div>
<div><span>Yearsl</span><span><?php the_field(''); ?></span></div>
</div>
Run Code Online (Sandbox Code Playgroud)
JQUERY
//hide unused fields
//iterate over each div
$('.accordion-content div').each(function(i, obj) {
// if the spans it contain are empty …Run Code Online (Sandbox Code Playgroud)