den ajax ehema nethuwa ma ba ne ban.. den owa onemai
firebug dalada tiyenne? errors enne nedda? code eka post karapan balanna..
jquery load wenawada?
script ekata meka dala balanna..
PHP:(function($){ console.log('OK'); })(jQuery)

<script type="text/javascript">
var base_url = "<?php echo base_url() ?>";
$(document).ready(function (){
add_item();
});
function add_item()
{
$('#add').click(function(){
var country = $('#country').val();
var position = $('#position').val();
var from = $('#from').val();
var to = $('#to').val();
if (country == '', position == '', from == '', to == '')
{
alert('ERROR');
}
else
{
$.post(base_url + 'index.php/Ajax/function_name',
{
'country': country,
'position': position,
'from': from,
'to': to
},
function (result)
{
if (result == 'Yes')
{
alert("yes");
}
else
{
alert("No");
}
}
);
}
});
}
</script>


Cookie clear karala balanna... PMA eka JS nathuwa wunath wada karanawa. Js support eka cookie ekaka thamai save karaganne.
Matanam ehema awulak wela na ban kawadawath.


1st time une! 




jQuery load wenawa ban
mama wada karanne CodeIgniter walin.
Console ErrorPHP:<script type="text/javascript"> var base_url = "<?php echo base_url() ?>"; $(document).ready(function (){ add_item(); }); function add_item() { $('#add').click(function(){ var country = $('#country').val(); var position = $('#position').val(); var from = $('#from').val(); var to = $('#to').val(); if (country == '', position == '', from == '', to == '') { alert('ERROR'); } else { $.post(base_url + 'index.php/Ajax/function_name', { 'country': country, 'position': position, 'from': from, 'to': to }, function (result) { if (result == 'Yes') { alert("yes"); } else { alert("No"); } } ); } }); } </script>
View attachment 59382
"NO" kiyalaa nan alert wenawa!
db, table names wenas kaleth na.
controller - function codes wenas kaleth na.
model - functions codes wenas kaleth na.
eeye wada kala dan wada karanne na.
![]()
![]()
![]()
![]()
phpmyadmin wada karanawa.. js witharai wada naththe...
settings wenas kaleth na..
matath kawadaawath wela naha..1st time une!
mee ekak wath wada karanne naha...
View attachment 59388
View attachment 59389
View attachment 59390
mama me aapahu reinstall karanna kiyala baluwe..![]()
wen browser ekak?




php script eken ena out eka balanna..
![]()


$del_id = trim($this->input->post('del_id');






hari yako hari!![]()
![]()
![]()
![]()
![]()
![]()
ajax.php eke bara pathala pallamaka ")" k missing!![]()
PHP:$del_id = trim($this->input->post('del_id');
trim() ekak ooneth na! mongal ban mata welaawakata!
ohee wikaaren code karanawa!
eeth mata error eka hoyaa ganna amaru una ban google chrome eken!
Firefox daala tak gaala hoyaa gaththa....
honda debug extension ekak hoyala balanna one Google Chrome walata![]()

hari yako hari!![]()
![]()
![]()
![]()
![]()
![]()
ajax.php eke bara pathala pallamaka ")" k missing!![]()
PHP:$del_id = trim($this->input->post('del_id');
trim() ekak ooneth na! mongal ban mata welaawakata!
ohee wikaaren code karanawa!
eeth mata error eka hoyaa ganna amaru una ban google chrome eken!
Firefox daala tak gaala hoyaa gaththa....
honda debug extension ekak hoyala balanna one Google Chrome walata![]()
<?php
/*
* Application: My Reminders (NCC Level 5 June 2014).
* Author: ******* (www.*******.com).
* Ajax call file.
*/
define('_VALID', true); // Hack for the security check. Make this accessible.
require_once('includes/process.php');
?>
<?php
/*
* Author: ******* (www.*******.com).
* Main process file used to process data sent though ajax requests.
* Posted action is used to switch the action of processing.
*/
defined('_VALID') or die('Restricted Access!'); // Preventing direct access of the file for security.
require_once(dirname(__FILE__).'/config.php'); // Including the main configuration file.
/*
* Main processing script switched by the action.
*/
if(isset($_POST['action'])){
if($_POST['action']=='login'){
/*
* Processing the user login.
*/
$username = stripslashes(strip_tags($_POST['username']));
$password = stripslashes(strip_tags(md5($_POST['password'])));
if(checkUsername($username)==false){ // Check for the already registered email addresses.
die('Account with provided username is not available');
}
$role = authenticateUser($username, $password);
if($role!=false){ // Authenticating the user.
$userinfo = array();
$userinfo = getUserInfoByUsername($username, $role);
if($role=='std'){
$uid = $userinfo['stId'];
}elseif($role=='stf'){
$uid = $userinfo['staffId'];
}
if(isset($_POST['remember'])){
if(!isset($_COOKIE['USR']))
setcookie("USR", $role.'_'.$uid, time()+172800); // Setting user remind cookie.
}
else{
if(!isset($_SESSION))
session_start(); // Starting the session.
if(!isset($_SESSION['USR']))
$_SESSION['USR'] = $role.'_'.$uid; // Setting the session variable.
}
echo 'true';
exit;
}else{
die('Either username or password does not matched');
}
mysql_close($connect);
}else{
die('Restricted Access!');
}
}
else{
die('Restricted Access!');
}
?>
uba code liyanne ajax.php ekemada? mama nam tikak wenas method ekak use karanne..
ajax.php
process.phpPHP:<?php /* * Application: My Reminders (NCC Level 5 June 2014). * Author: ******* (www.*******.com). * Ajax call file. */ define('_VALID', true); // Hack for the security check. Make this accessible. require_once('includes/process.php'); ?>
meka mama me awrudakata witara kalin liwwa ekak yaluwek ge assignment ekakata.. den nam thawath tikak wenas widihata liyanne..PHP:<?php /* * Author: ******* (www.*******.com). * Main process file used to process data sent though ajax requests. * Posted action is used to switch the action of processing. */ defined('_VALID') or die('Restricted Access!'); // Preventing direct access of the file for security. require_once(dirname(__FILE__).'/config.php'); // Including the main configuration file. /* * Main processing script switched by the action. */ if(isset($_POST['action'])){ if($_POST['action']=='login'){ /* * Processing the user login. */ $username = stripslashes(strip_tags($_POST['username'])); $password = stripslashes(strip_tags(md5($_POST['password']))); if(checkUsername($username)==false){ // Check for the already registered email addresses. die('Account with provided username is not available'); } $role = authenticateUser($username, $password); if($role!=false){ // Authenticating the user. $userinfo = array(); $userinfo = getUserInfoByUsername($username, $role); if($role=='std'){ $uid = $userinfo['stId']; }elseif($role=='stf'){ $uid = $userinfo['staffId']; } if(isset($_POST['remember'])){ if(!isset($_COOKIE['USR'])) setcookie("USR", $role.'_'.$uid, time()+172800); // Setting user remind cookie. } else{ if(!isset($_SESSION)) session_start(); // Starting the session. if(!isset($_SESSION['USR'])) $_SESSION['USR'] = $role.'_'.$uid; // Setting the session variable. } echo 'true'; exit; }else{ die('Either username or password does not matched'); } mysql_close($connect); }else{ die('Restricted Access!'); } } else{ die('Restricted Access!'); } ?>

public function function_name_1()
{
$this->load->model('model_1');
if ($this->model_1->step_2(
trim($this->input->post('field_1')),
trim($this->input->post('field_2')),
trim($this->input->post('field_3')),
trim($this->input->post('field_4'))
))
{
echo "Yes";
}
else
{
echo "No";
}
}
public function step_2($field_1= NULL, $field_2 = NULL, $field_3 = NULL, $field_4 = NULL)
{
if ($this->db->query("INSERT INTO tbl_1(`id`,`field_1`,`field_2`,`field_3`,`field_4`) VALUES ('".$_COOKIE['id']."','".$field_1."','".$field_2."','".$field_3."','".$field_4."')"))
{
return TRUE;
}
else
{
return FALSE;
}
}

mama codeignither framework eke karanne ban.
ajax.php eka samanya controller ekak.
mulin eekata data gannawa.
passe model ekata pass karanawa db ekata gahanna.
ajax.php
model_1.phpPHP:public function function_name_1() { $this->load->model('model_1'); if ($this->model_1->step_2( trim($this->input->post('field_1')), trim($this->input->post('field_2')), trim($this->input->post('field_3')), trim($this->input->post('field_4')) )) { echo "Yes"; } else { echo "No"; } }
db connections framework eka config karaddima set karanawa ban..PHP:public function step_2($field_1= NULL, $field_2 = NULL, $field_3 = NULL, $field_4 = NULL) { if ($this->db->query("INSERT INTO tbl_1(`id`,`field_1`,`field_2`,`field_3`,`field_4`) VALUES ('".$_COOKIE['id']."','".$field_1."','".$field_2."','".$field_3."','".$field_4."')")) { return TRUE; } else { return FALSE; } }![]()
![]()
