Reputation: 1221
I use this code to load data into my textarea:
jQuery('.content_container').load('http://www.evedalsvardshus.se/plugins/calendar/edit_dates.php', {'value': datum} );
But when I try to load data into my input text form with this code:
jQuery('.header').load('http://www.evedalsvardshus.se/plugins/calendar/get_header.php');
Nothing happens. The get_header.php contains only "asdsd".
Can anyone help me?
Upvotes: 12
Views: 17944
Reputation: 1039110
That's because the .load()
function tries to set the inner HTML which doesn't work for a text field. You need to set its value instead:
$.get('/plugins/calendar/get_header.php', function(result) {
$('.header').val(result);
});
The .get()
function sends an AJAX request and in the success callback set the value of the text field.
Upvotes: 17