There is my code:
var formObject = {
run : function(obj) {
if (obj.val() === '') {
obj.nextAll('.update').html('<option value="">----</option>').attr('disabled', true);
}
else
{
var id = obj.attr('id');
var v = obj.val();
jQuery.getJSON('update.php', { id : id, value : v }, function(data) {
if (!data.error) {
obj.next('.update').html(data.list).removeAttr('disabled');
} else
{
obj.nextAll('.update').html('<option value="">----</option>').attr('disabled', true);
}
});
}
}
};
$(function() {
$('.update').on("change", function() {
formObject.run($(this));
});
});
I need to call specific controller in order to populate the select form automatically.
In this line of code i am calling an url:
jQuery.getJSON('update.php', { id : id, value : v }, function(data)
I it possible to call a codeigniter view instead this ‘update.php’ file, or i have to do it in other way? Thanks.
1 Answer