• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database LiveSearch

ok, now check through search area.

Quote:Message: Undefined index: partialSearch
You're not getting your post array index "partialSearch"

function getSearchResults(value) {
   $.post("getSearchResults.php",{partialSearch:value}, function(data){
and alert/check if value actually contains something. If it doesn't $_POST['partialSearch'] will be empty, thus false, thus undefined (I think).

Alert is working fine.

Okay, so your alert is alerting your value, so we know that that is working
public function getSearchResults()
// $this->load->database();  
  $partialSearch = $_POST['partialSearch'];
and comment out the rest of the code, what kind of variable is $partialSearch?

And are there any error in Firebug console?

$partialSearch is a string. It will be used to reference phone numbers. since it is currently checking users email address', I keep searching for the first few characters of my email that is on the user table.

firebug console shows:

POST http://localhost/crm/index.php/search/getSearchResults 500 Internal Server Error

Are you sure CSRF is not set to true in your config file?

Hmm. It was set to true. Sorry, when you asked if it was autoloaded earlier, I didn't set it to autoload. Didn't know it was in the config file. Sorry about that.

It is all working properly now. Thank you all for all the help.

lol... yeah, okay, just so you know what was happening:
CSRF was set to true (to prevent against cross site hacking). Because you were submitting $_POST values but without the CSRF code/hash it was failing and returning the internal 500 error - which is a good thing!

Basically you want to keep it enabled/set to true, so your work is not quiet over yet. Just do a google on "codeigniter submit form via ajax with CSRF enabled" to figure it out, there are a couple of options (I'm at work, cannot remember the syntax off the top of my head).

Glad we got there in the end!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.