title: How to store last insert id in codeigniter session if insert is donr by AJAX?
body: <p>I need to insert last insert id of user on some event .....
  And I want to get that on another page....
  Like On product page ....user customizing his product....like <a href="http://www.zazzle.com/registered_nurse_symbol_coffee_mugs-168057801348371344" rel="nofollow">mug customization </a></p>
  
  <p>And i need to get the inserted....customization product id to the cart page and this is done by ajax....so how can i get last insert id on cart page from product page....</p>
  
  <h2>my ajax...</h2>
  
  <pre><code>$('#store').click(function () {
  
      $.ajax({
          type: "POST",
          url: ajax_url_store,
          data: {
              action: 'store',
              views: JSON.stringify(thsirtDesigner.getProduct())
          },
  
          success: function (data) {
  
              if (parseInt(data) &gt; 0) {
                  //successfully added
  
                  document.getElementById('succes-message').innerHTML = 'You Design has Been SuccessFully Saved';
              } else {
  
              }
  
          },
          error: function () {
              //alert('some error has occured...');
          },
          start: function () {
              //alert('ajax has been started...');    
          }
      });
  });
  </code></pre>
  
  <p>My ci function</p>
  
  <pre><code>public function saveData() {
  
      if ($this - &gt; input - &gt; post('action') == 'store') {
  
          $views = $this - &gt; input - &gt; post('views');
          $id = $this - &gt; product_model - &gt; save($views);
  
          if ($id != '') {
              header('Content-Type: application/json');
              echo json_encode($id);
          }
      }
  }
  </code></pre>