Welcome Guest, Not a member yet? Register   Sign In
Database LiveSearch
#31

[eluser]sanir[/eluser]
ok, now check through search area.
#32

[eluser]boltsabre[/eluser]
Quote:Message: Undefined index: partialSearch
You're not getting your post array index "partialSearch"

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

[eluser]joe.afusco[/eluser]
Alert is working fine.
#34

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

And are there any error in Firebug console?
#35

[eluser]joe.afusco[/eluser]
$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
#36

[eluser]boltsabre[/eluser]
Are you sure CSRF is not set to true in your config file?
#37

[eluser]joe.afusco[/eluser]
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.
#38

[eluser]boltsabre[/eluser]
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!




Theme © iAndrew 2016 - Forum software by © MyBB