script438: 对象不支持ajax属性或方法,SCRIPT438:对象不支持属性或方法'forEach'(SCRIPT438: Object doesn't support property o...

SCRIPT438:对象不支持属性或方法'forEach'(SCRIPT438: Object doesn't support property or method 'forEach')

IE8支持属性或方法'forEach'

$('.tabs').tabs();

$('#search-consumables [data-ajax-call]').change(function() {

var $this = $(this),

settings = $this.data(),

$target = $(settings.target);

$.ajax({

type: 'GET',

url: 'index.php?route=module/quicklookup/' + settings.ajaxCall,

data: $this.closest('form').serializeArray(),

dataType: 'json',

success: function(data) {

var html = '';

$target.find(':not(.blank)').remove();

html = $target.html();

data.forEach(function(entry) {

html += ''+entry.name+'';

});

$target.html(html);

}

});

});

我努力了

$.each(data, function(entry) {

但是数据然后返回undefined,我在IE8中使用了什么?

IE8 support property or method 'forEach'

$('.tabs').tabs();

$('#search-consumables [data-ajax-call]').change(function() {

var $this = $(this),

settings = $this.data(),

$target = $(settings.target);

$.ajax({

type: 'GET',

url: 'index.php?route=module/quicklookup/' + settings.ajaxCall,

data: $this.closest('form').serializeArray(),

dataType: 'json',

success: function(data) {

var html = '';

$target.find(':not(.blank)').remove();

html = $target.html();

data.forEach(function(entry) {

html += ''+entry.name+'';

});

$target.html(html);

}

});

});

I have tried

$.each(data, function(entry) {

yet data then returns undefined, What am I missing to get this working in IE8?

原文:https://stackoverflow.com/questions/15843834

更新时间:2020-02-11 11:15

最满意答案

传递给jQuery.each回调的第一个参数是数组中值的索引; 第二个参数是实际值。

尝试使用:

$.each(data, function(i, entry) {

// your code here

});

The first argument passed to the jQuery.each callback is the index of the value in the array; the second argument is the actual value.

Try using:

$.each(data, function(i, entry) {

// your code here

});

相关问答

由于IE不支持Array.from方法,您可以尝试使用: [].slice.call(document.getElementsByTagName('span')).forEach(function(v) {});

这不需要使用任何第三方库。 As Array.from method is not supported by IE, you can try to use: [].slice.call(document.getElementsByTagName('span')).forEach(fun

...

您需要在循环中引用工作簿,否则默认情况下它将引用在执行代码时处于活动状态的工作簿。 认为这应该工作。 Sub testo()

Dim ws As Worksheet

For Each ws In Workbooks("ETAT.xlsx").Worksheets

ws.Range("a14").Value = 150

Next ws

End Sub

You need to refer to the workbook in your loop, otherwise by defaul

...

在Internet搜索几天之后,我发现这个错误通常发生在一个HTML元素id与javascript函数中的一些变量相同的id时。 改变其中一个的名字后,我的代码工作正常。 After some days searching the Internet I found that this error usually occurs when an html element id has the same id as some variable in the javascript function. Af

...

错误就在这里 lastrow = wsPOR.Range("A" & Rows.Count).End(xlUp).Row + 1

wsPOR是一本工作簿而不是工作表。 如果您正在使用该工作簿的“Sheet1”,请尝试此操作 lastrow = wsPOR.Sheets("Sheet1").Range("A" & _

wsPOR.Sheets("Sheet1").Rows.Count).End(xlUp).Row + 1

同样 wsPOR.Range("A2:G" & las

...

较旧的浏览器可能不支持Window.bota ,它基本上是一种奇怪命名的方法,可以将字符串转换为base64表示,如您所知。 在旧版浏览器中提供新功能称为“polyfilling”。 将脚本base64.js ( 下载 )或base64.min.js ( 下载 )放在您的网站上(我假设您正在使用后者,并将其放在/js/vendor目录中),并引用它因此( 在你需要使用Window.bota ):

...

看来你有图表 。 尝试更改您的代码,如下所示: Sub MACRO()

bAlerts = Application.DisplayAlerts

Application.DisplayAlerts = False

For i = 1 To Worksheets.Count

Worksheets(i).Cells.Replace What:="C:\", Replacement:="C:\Gestion\"

Next

Application.Di

...

什么是this.model ? 你是如何实例化那个观点的? 我猜这个。 this.model不应该是它应该是什么。 在视图中, model属性应该是一个模型实例,你可以这样说: var m = new Model;

var v = new View({ model: m });

模型实例将具有bind方法(AKA on ),但在非石器时代的浏览器中, 函数也是如此 : bind()方法创建一个新函数,在调用时,将其this关键字设置为提供的值,并在调用新函数时提供任何前面提供的给定参数序列。 模

...

传递给jQuery.each回调的第一个参数是数组中值的索引; 第二个参数是实际值。 尝试使用: $.each(data, function(i, entry) {

// your code here

});

The first argument passed to the jQuery.each callback is the index of the value in the array; the second argument is the actual value. Try us

...

这是我的猜测(因为我们缺乏信息) 。 它可以是以下的组合: 您正在IE8中进行测试,或者如果您使用的是IE9,那么您处于Quirks模式 当你构建数组时,你包括一个尾随, 在Quirks模式下,或者在IE8及更低版本中,如果在Array文字语法中包含尾随逗号,它将(错误地)在数组末尾添加一个额外项。 这意味着您的最后一项将是undefined ,当您使用.join()时,您将收到错误。 在IE8及更低版本或Quirks模式下的任何版本中,您将获得以下内容: var items = [

["

...

你有几个问题 您需要将范围称为Range("A:A")而不是"A:A" 如果您正在使用VLOOKUP而不是LOOKUP那么您需要引用四列范围, Range("A:D") 您需要处理在A中找不到的测试值 以下示例代码供您调整 Dim strLookfor as String

Dim strOut

strLookfor = "test"

strOut = Application.VLookup(strLookfor, Range("A:D"), 4, True)

If IsError(strOut)

...

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值