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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With