Welcome Guest, Not a member yet? Register   Sign In
problem when trying to access a controller function from a view using Cjax methods
#1

[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
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");

}
}
?>

Here is the View file

<?php
require_once "ajax.php";
$ajax = ajax();
$ajax->Exec("button1",$ajax->call("ajax.php?gethint/click_button/Hello!")Wink;
?>
<html>
<head>
<?php echo $ajax->init();?>
</head>
<body>
<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;
Quote:Please somebody help me to get out of this
#2

[eluser]saran12[/eluser]
please try this one , you need to require ajaxfw.php instead of ajax.php.




Theme © iAndrew 2016 - Forum software by © MyBB