weixin_33705053 2015-05-05 22:40 采纳率: 0%
浏览 55

jQuery替换HTML div值

I am forming the div dynamically on document load like below. I have a ajax call and on response fro the AJAXcall I want to replace the value 'right' with the value from the AJAX call using jQuery.

Basically I want to replace the value for the text div mentioned below once AJAX has the success data.

var beginContainer = '<div class="container">';
var endDiv = '</div>';
var beginInner = '<div class="inner">';
var text = '<div class="text" id=3 style="color:#0000FF" align ="center">';
var append = beginContainer + beginInner + text + 'Number of sensors' + endDiv + text + '10cents/sensor' + endDiv + endDiv + beginInner + text +'right'+endDiv +endDiv;

$('#content').append(append);  

var beginContainer = '<div class="container">';
var endDiv = '</div>';
var beginInner = '<div class="inner">';
var text = '<div class="text" id=4 style="color:#0000FF" align ="center" value="kkk">';
var append = beginContainer + beginInner + text + 'Total Bill' + endDiv + text + 'Month-to-Month' + endDiv + endDiv + beginInner + text +'right'+endDiv +endDiv;

$('#content').append(append);
  • 写回答

2条回答 默认 最新

  • weixin_33743703 2015-05-05 22:42
    关注

    use this for your ajax call:

    $.ajax("URL.com",function(e){
      $("#wherever").html(e);
    });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料