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);
    });
    
    评论

报告相同问题?