weixin_33725272 2015-02-13 16:07 采纳率: 0%
浏览 11

Ajax + js(无jquery)

I have a trouble with IE. This code isn't working in IE, but in others it works well. I found that IE isn't working with jQuery AJAX, so its need to be without. Maybe somebody knows about this

$(document).ready(function () {
    $.ajax({
        url: 'http://api.randomuser.me/?results=11',
        dataType: 'text',
        success: function (result, textStatus, XMLHttpRequest) {
            console.log(result);
            //alert(result);
            var event = JSON.parse(result);
            var our_html = "<table 'border='0' cellpadding='0' cellspacing='0'>";
            our_html += "<tr><th style='width:52px;border-left:none;'>№</th><th>Имя Фамилия Отчество</th><th>Адрес</th><th>Фото</th><th style='width:180px;border-right: none;'>Действие</th></tr>";
            event.results.forEach(function (item, item_number) {
                var u = item.user;
                our_html += "<tr>";
                our_html += "<td style='width:52px;'>" + (parseInt(item_number) + 1) + "</td>";
                our_html += "<td class='usname'>" + u.name.title + "." + "<span>" + u.name.first + "</span>" + " " + "<span>" + u.name.last + "</span>" + "</td>";
                our_html += "<td class='usst'>" + "<span>" + u.location.city + "</span>" + ", " + u.location.street + "</td>";

                our_html += '<td style="width:146px;"><img style="max-width:60px; max-height:60px;border-radius: 30px;" src="' + u.picture.medium + '"></td>';
                our_html += '<td style="width:180px; border-right: solid 1px #e1e1e1;"><div class="more" onclick="alert("' + u.name.first + '")">Просмотреть</div></td>';
                our_html += "</tr>";
            });
            our_html += "</table>";

            document.getElementById("table-wrapper").innerHTML = our_html;
            //alert (event.results[0].user.name.title);  // Goper
            //$(".simple p").text(event.results[0].user.name.title);
        }
    });
});
  • 写回答

2条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 Android URL如何转成视频/音频,可行吗?
      • ¥20 SQL数据查询,子查询
      • ¥15 c++字符串分割问题
      • ¥15 关于#sql#的问题:没有用命令关闭cdc,手动把系统表开启的cdc右键删除了
      • ¥15 vue+uniapp
      • ¥15 android freedom
      • ¥15 使用自定义的类型代替内置类型可行吗
      • ¥15 关于STM32的SPI和ENDAT接口编码器通信的问题
      • ¥15 关于#pdfbox#生成的PDF文件正常,转图片中文乱码的问题,如何解决?
      • ¥15 ADS中有关DAC控件的使用问题