Welcome Guest, Not a member yet? Register   Sign In
Ajax Framework (CJAX) for Codeigniter 2.x+

[eluser]ev0ken[/eluser]
Hey Great framework but I keeping getting a error my $subject_id is putting "css" instead of the id. $subject_id has the correct value set because if I echo it the returned value is the correct one I want but for some reason inside the $ajax->exec function its sending "css". Sorry about my english i've been up all night

[eluser]Ajaxboy[/eluser]
Hello ev0ken,

Could you please post your code that you are using? thanks. Also be sure sure you are using the latest release (5.0-stable).

[eluser]ev0ken[/eluser]
Wont let me post code can i email you? Also yes i'm using the current version I downloaded it yesterday Tongue

[eluser]Ajaxboy[/eluser]
I got the email.

you have multiple php syntax errors in your code. Sorry but you have alot of things backwards in your code, I can try to help but you must posses at least general php knowledge to be able to use this ajax framework without much pain, I am not going to teach php.

Here I fixed the syntax for you. Also your html element HAVE TO exist in the view.

The 'blad' and 'lol' are in the parameter for element/div id in which the response is loaded to.

You only need to do $ajax = ajax() once (per scope).


there is some filtering going on and some of the code is being obfuscated/truncated, I'll reply the code to your email.


Code:
$ajax = ajax();

?>
<div class = "subj-nav">
&lt;?php
if(isset($catg_data)) {

foreach($catg_data as $catg) {
  ?&gt;<a href ='#' id = 'catg&lt;?php echo $catg['>&lt;?php echo $catg['catg_name'];?&gt;</a>&lt;?php


  if($this->tank_auth->is_logged_in()){
   $logged_in = 1;}
  else {
   $logged_in =0;
  }

  $ajax->Exec('catg'.$catg['catg_id'],

  $ajax->call(base_url('ajax.php?post/get_prod/'.$catg['catg_id'].'/'.$logged _in), 'blad'));

}

}
if($this->tank_auth->is_logged_in()) {
echo "<a href = '#' id ='add_inv'>+Add Category</a>";
$ajax->Exec('add_inv',$ajax->call(base_url('ajax.php?post/add_inv/'.$subject_id.'/add'), 'lol'));
}
?&gt;
</div>


I am assuming you are passing the $subject_id through parameter in your view, yes?

This is the code you sent me:
Code:
<div class = "subj-nav"> &lt;?php if(isset($catg_data)) {

foreach($catg_data as $catg) {
echo "<a href ="#" id = "catg">”;

$ajax = ajax();
if($this->tank_auth->is_logged_in()){ $logged_in = 1;} else { $logged_in =

0; }

$ajax->Exec('catg'.$catg['catg_id'],

$ajax->call(base_url('ajax.php?post/get_prod/'.$catg['catg_id'].'/'.$logged _in), 'blad'));

}

} if($this->tank_auth->is_logged_in()) {

echo "<a href = "#" id ="add_inv">+Add Category</a>";
$ajax = ajax();
$ajax->Exec('add_inv',

$ajax->call(base_url('ajax.php?post/add_inv/'.$subject_id.'/add'), 'lol')); }

[eluser]ev0ken[/eluser]
Thank you I got it to work by just removing the extra $ajax = ajax(); calls. Sorry My code was so rough when i sent it you I've only been coding for around 2 months I sent you a rough draft Tongue Thank you for such a quick reply as well.

[eluser]MonsterTKE[/eluser]
@AjaxBoy

Now that we have a stable release, is there any chance to possibly see some debugging on mobile browsers?

[eluser]Ajaxboy[/eluser]
That is currently not on the to do list, what phone OS (and browser) are you interested in debugging on ?

[eluser]MonsterTKE[/eluser]
[quote author="Ajaxboy" date="1342301283"]That is currently not on the to do list, what phone OS (and browser) are you interested in debugging on ?[/quote]

Well iPhone and android cover like 90% of the mobile market I think.

[eluser]mad82[/eluser]
Hi, I got a problem when trying to access a controller function from a view using Cjax methods, its bit frustrating me, any help is greatly appreciated, Below is the code i used
controller file code
Code:
class Gethint extends CI_Controller {
function _construct()
{
  parent::_construct();
  $this->load->helper(array('form','url'));
  
        }

public function index()
{
  $this->load->view('click_ajax_request');
}

function click_button($message)
{
  echo "Button clicked";
  $ajax = ajax();
  
  $ajax->success("You clicked the button.. $message");
  
}
}
?&gt;

Here is the View file
Code:
&lt;?php
require_once "ajax.php";
$ajax = ajax();
$ajax->Exec("button1",$ajax->call("ajax.php?gethint/click_button/Hello!"));
?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;?php echo $ajax->init();?&gt;
&lt;/head&gt;
&lt;body&gt;
<h2>Simple ajax request binded to a button</h2>
&lt;input type='button' id='button1' value='Click this button to make an ajax request'&gt;
&lt;/body&gt;
&lt;/html&gt;

[eluser]Ajaxboy[/eluser]
I replied to your other post here: http://ellislab.com/forums/viewthread/222566/





Theme © iAndrew 2016 - Forum software by © MyBB