codeigniter - How to call controller from another url with post data? -


i have problem project using codeigniter. want run controller url(without project) post data. i'm using codeigniter framework? have way this? please me resolution problem...

all can think of using ajax , not recommended use javascript part of controller

in controller

<?php if ( ! defined('basepath')) exit('no direct script access allowed');  class controllera extends ci_controller {       function __construct()     {         // can put ajax call here if want run each time call controller     }      public function ajaxcall()     {     // make sure didn't call jquery before won't have conflicting scripts     echo '<script src="https://code.jquery.com/jquery-1.11.3.min.js"> </script>';      // use ajax post controller b      echo     '<script>     var target_url = "http://www.example.com/projectb/controllerb"     var data = {user_id:542,name:"baci"};     $.ajax(             {                 url : target_url,                 type: "post",                 data : data,                 success: function(data)                 {                      alert("all right request sent via ajax  ");                  },                 error: function(jqxhr, textstatus, errorthrown)                 {                     alert("request failed !  ");                 }             });     </script>     ' ;      // continue code on controller while ajax call being sent     } } 

Comments