Reputation: 107
Im trying to load a numeric value from the database into the textbox named jTagLabel. Its from the JTag API, and the way it is set up, the html code is inside of a jquery.
So first I make a jquery statement to load the value of a span called span1 from a php file called tag count. Ive tested this part and it works fine.
$('#jTagLabel.val()').load('tagcount.php #span1');
$('<div style="width:'+options.defaultWidth+'px;height:'+options.defaultHeight+'px"class="jTagDrag"> <div class="jTagSave"><div class="jTagInput"><input type="text" value="" id="jTagLabel"></div><div class="jTagSaveClose"></div><div class="jTagSaveBtn"></div><div style="clear:both"></div></div>').appendTo(overlay);
What im trying to do is make the .load appear as the value=" " of "id=JTagLabel" above. Any and all help is appreciated.
*Note, the Jquery .load statement is written after the div statement, but for this example, i placed it first.
Upvotes: 0
Views: 412
Reputation: 5198
Something like this perhaps?
$.get('tagcount.php', function(data) {
var span_text = $('<div>')
.append(data)
.find('#span1').html();
$('#jTagLabel').val(span_text);
});
That's how .load() does things. It does try to remove <script>
tags though.
Upvotes: 1