Showing posts from October, 2018

Update existing session array variable in CodeIgniter

If you want to change one or two data then need to load old session variable and add new value as per your need.

$userData    =   $this->session->userdata('frontend'); // old session array
$userData['theme']= $this->input->post('theme'); // new value
$this->session->set_userdata('frontend', $userData);

Call AJAX with select onchange using jQuery

Below is the code where you can easily understand select Tag on change with ajax request using PHP.
Replace id #theme_option with yours.

<select class="form-control" id="theme_option">
<option value="default">Default</option>
<option value="real-estate">Real Estate</option>
<option value="dispatching">Dispatching</option>
<option value="dental">Dental</option>
<option value="medical">Medical</option>
<option value="restaurant">Restaurant</option>
<option value="consumer-product">Consumer Product</option>

Jquery code

    $('#theme_option').change(function(){ $.ajax({ url: "change_theme.php", data: { "theme": $("#theme_option").val() }, type: "post", success: function(data){    window.location.reload(); } }); }); });