Welcome Guest, Not a member yet? Register   Sign In
session problem
#21

[eluser]CI_avatar[/eluser]
it seems above that you will be redirected to index.php/processor (index.php?c=controller),
but not. It will be requested on the fly - it will be executed without reloading the page.
#22

[eluser]paulon[/eluser]
Code:
$(document).ready(function(){

$(function(){
    $(".submit-btn").click(function(){
      $.post('index.php?c=processor', { //or $.post('index.php/processor'
        //list of post variable follows
        samplevar      : 'addrequisition',
        samplevar2     : $("[name=username]").val()
        //...more variable
      },function(data){
        alert(data); //display the echo from processor.php
                     //If you echo "hello world" in processor.php
                     //and after calling ajax then hello world alerted
                     //it means that you requested the processor.php successfully
                     //note: data variable holds the values echoed from processor.php
      });
});

});

so you where just saying that i just need to pass another variable to to processor.php?

Code:
//processor.php

if(!define($_POST['samplevar'])){
  die('no direct access allowed');
}else{
  echo 'hello world';
}
#23

[eluser]paulon[/eluser]
nice it fixed my problem regarding direct access to scripts

Code:
//javascript
var obj = {
get_user_online: function(){
   var url="<?=base_url()?>index.php/generals/getuseronline";
   $.post(url,{isAllowed:1},
      function(data){
         document.getElementById("divuserlist")[removed] = data;
      });        
}
}

that calls in
Code:
//php script
function getuseronline(){    
   if($_POST['isAllowed']>0){        
      $strReturn = 'Hello world';
   }else{
      $strReturn = 'No direct access allowed';
   }
echo $strReturn;
}

so when ever the link type in directly into the browser "http://localhost/CI/index.php/generals/getonlineuser"
it returns a "No direct access allowed'
#24

[eluser]CI_avatar[/eluser]
@paulon did it solve the problem?
#25

[eluser]paulon[/eluser]
@CI_avatar

yes, it resolves the problem.. +1 to you CI_avatar..
:-P
#26

[eluser]CI_avatar[/eluser]
You're welcome Pau.
later...

Kitakits next time.
#27

[eluser]paulon[/eluser]
sure makati area ako.. tnx and merry xmas..




Theme © iAndrew 2016 - Forum software by © MyBB