Can I do something like this:
$('#myTag').attr('value').load('my_php_file.php');
No, because .attr('value') returns a string (representing the value of the value attribute on the DOM element) and it is pretty meaningless to call the .load() method on a string. You usually call this method on a DOM element. To illustrate your problem, here's what your code is equivalent to:
var value = 'some value';
value.load('my_php_file.php');
Nonesense.
Did you mean:
$.ajax({
url: 'my_php_file.php',
success: function(result) {
$('#myTag').val(result);
}
});
$.ajax({ url: 'my_php_file.php', success: function(result) { $('#myTag').val(result); } });?
$.getor$.ajaxsince it wouldn't require creating a dummy dom element to temporarily contain the string.