Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load data into input text form

Tags:

jquery

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?

like image 360
user500468 Avatar asked Nov 08 '10 08:11

user500468


1 Answers

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.

like image 70
Darin Dimitrov Avatar answered Sep 29 '22 11:09

Darin Dimitrov