热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Jquery没有将数组输出到HTML中-JquerynotoutputtinganarrayintoHTML

AlrightsoIamtryingtooutputsimpleJSONarrayinajaxbutnomatterwhatIdotheHTMLwontapp

Alright so I am trying to output simple JSON array in ajax but no matter what I do the HTML wont appear on the page at all...

好吧所以我试图在ajax中输出简单的JSON数组,但无论我做什么,HTML都不会出现在页面上......

$("#menu_zalbe").click(function() {

    $.ajax({
        url:"assets/core/handlers/reportHandler.php",
        type:"POST",
        data:{function:"getAll"},
        dataType:"json",
        success:function(data) {
            for(var i = 0; i 
'"); } }, error:function(data) { console.log(data); } }); });

I did console.log to check if there is an error or if it passing wrong data but everything is absolutely correct, there doesnt seem to be any problems but the HTML wont pop up on the page itself

我做了console.log以检查是否有错误或者是否传递了错误数据但是一切都是绝对正确的,似乎没有任何问题但HTML不会弹出页面本身

2 个解决方案

#1


0  

There might be a problem with your jQuery selector. Are you sure there's an element with id content_split?

您的jQuery选择器可能存在问题。你确定有一个id为content_split的元素吗?

Also, you'll need to modify your success callback to this

此外,您还需要修改成功回调

  // ...
  success:function(data) {
          $("#content_split").html('');
          for(var i = 0; i 
'"); } }, //...

#2


0  

I fixed the problem by re-creating the HTML output itself, it had something to do with the original HTML code that I used, once I replaced it with the fresh typed one it worked. It have must been and ID problem or such

我通过重新创建HTML输出本身来修复问题,它与我使用的原始HTML代码有关,一旦我用它工作的新类型替换它。它必须和ID问题等


推荐阅读
author-avatar
乐檬
这个家伙很懒,什么也没留下!
Tags | 热门标签
RankList | 热门文章
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有