Hi,
Through ajax I am posting a value to a Controller, which I need get on the Modal Window on the VIEW Value changes every time Modal Window is triggered,
When i trigger the below
{{ $fid = Session::get('field_id'); }}
Values doesnt get updated on the Modal, Shows the old (first) value only
<script>
function CustomizeFields(type_id, field_id) {
document.getElementById("type_id").value = type_id;
document.getElementById("field_id").innerHTML = field_id;
jQuery.ajax({
url: 'sessionfield',
type: 'POST',
data: {
txt: field_id
},
dataType : 'json',
success: function(data, textStatus, xhr) {
console.log(data); // do with data e.g success message
},
error: function(xhr, textStatus, errorThrown) {
console.log(textStatus.reponseText);
}
});
}
</script>
Controller Function
public function SessionField()
{
Session::put('field_id', $_POST['txt']);
return Session::get('field_id');
}
Are you using bootstrap by any chance? If so, have had this issue too. You need to reload the modal to be updated. I can't remeber the code of the top of my head that solved this. If you can't find it in google, let me know and I'll post it.
Sorry. Lame answer, but it might point you in the right direction.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community