• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
One of my controllers refuses to load any views!

#21
[eluser]Tim Brownlaw[/eluser]
So have you got error reporting turned on and with those display settings as I suggested earlier on.

Somethings going BANG! and that will help as any output (good or bad ) should be getting sent back... Anything that echoes back will be the "response" either which way.


#22
[eluser]dauber[/eluser]
Exactly as you suggested. Just after a couple of reloads (not even changing code!!!!!) the error log stopped populating. Permissions are good, restarted Apache. Really, maybe this is a sign that I need to change careers.

#23
[eluser]Tim Brownlaw[/eluser]
Nah it'll be simple! The trick is knowing how to dig in and work your way back out!
That's the really fun part!

Although with your issue it's being a little difficult to see what's actually going on!

From looking at the jquery ( not how I would have done it... but that's just me ) it looks "ok".
CroNiX should be able to shine some more light on that!

What we need to do is make 100% sure that what you are sending is being understood ( which you say it is... ) and that the response is being correctly generated ( which sounds like it isn't ).

This is where you'd be testing on the server itself, and pretending to be the client.. so you should be able to create a dummy requester ie a new method or even controller/method that mimics your Form Data you are sending... and seeing that you get the expected result.

Are you on skype or anything we can screen share?


#24
[eluser]dauber[/eluser]
I can do TeamViewer. If you're on a Mac, I can do that screen sharing that it's famous for but I've never used. Smile

#25
[eluser]InsiteFX[/eluser]
Your problem is in your Ajax method calling the Controller!

Code:
$.post('/index.php/srchgames_ctrl/do_search', {

// Try this:
$.post(<?php echo site_url('srchgames_ctrl/do_search'); ?>, {

Or in your html head tag add this:
Code:
// change $ to s in tags
<$cript>
  var _base_url = "&lt;?php echo base_url(); ?&gt;";
  var _site_url = "&lt;?php echo site_url(); ?&gt;";
</$cript>

Now you can use _base_url and _site_url in your javascript code.

#26
[eluser]dauber[/eluser]
....except that the $.post() is in a JS file.

#27
[eluser]CroNiX[/eluser]
A few things I see...

You are using ajax to call do_search. However, do_search uses a RETURN. That doesn't sent anything out to the browser, so that's why you see nothing. It returns to the last PHP function that called it which is probably the CI_Controller base class or something. That should be an echo since you want to output the result back to the ajax call, not return it to php. Also, you are returning a php array back to js, which js won't understand. You should probably be using
Code:
echo json_encode($search_result);

You should probably also tell your ajax call to expect json data back. jquery tries to guess, but unless you send json headers it might not work well, so just tell it at the very bottom of your ajax call.
Code:
//...
}).done(function() {
  console.log("DONE");
}, 'json'); //tell it to expect json result

#28
[eluser]InsiteFX[/eluser]
I know it's in an ajax js file, re-read my post.

#29
[eluser]dauber[/eluser]
Finally figured out the root of the problem.

First off, the actual issue was that I wasn't getting any return data from the jQuery's AJAX $.post(). Error logs showed that all the PHP code was working exactly as intended.

Then it hit me: it was because the button I was clicking on to get this stuff going was a submit button...which makes sense because my thinking was that I was submitting form data to do the search....except that when you use CodeIgniter's form helper and use a specific submit button, there's some kind of redirect going on. The give-away was that when I clicked that button I'd get a blank screen. I replaced the submit button with a standard button....problem solved!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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