I'm not a PHP guy, but does removing the leading /
in your directory string (/admin/get_galleries
) fix it? You'd append admin/get_galleries
instead, since your link variable already has the trailing /
.
A:
David Hoerster
2010-08-23 02:58:20
Unfortunately not. I updated the code for that. In my actual situation, I'm not using the link variable, I just pass in the full URL.
gamerzfuse
2010-08-23 03:00:29
Is the GET going to the same domain as the page that it's hosted on? I'm assuming it is, but thought I'd ask.
David Hoerster
2010-08-23 03:06:15
Also, if you replace the `$("#gallery...").html(gals)` call with an `alert(gals)`, what do you get? Have you monitored the call with Fiddler or Firebug -- anything coming back from the server?
David Hoerster
2010-08-23 03:07:49
a) The server is the same, so the Same Domain Policy doesn't apply. b) I have tried alerting it, and I get absolutely nothing back. I used firebug and even tried to console.log the data, but I never get a response.
gamerzfuse
2010-08-23 03:12:34
Do you know that it's getting processed on the server side - debugging/tracing/output-to-text-file/etc.? Sorry for the obvious questions.
David Hoerster
2010-08-23 03:15:20
have you tried navigating the get url from the browser directly?try to navigate this on the browser "http://www.example.com/admin/get_galleries" then view the source of when it's done. Inspect if there is a result, or the results are valid.
jerjer
2010-08-23 03:58:09
it would also be helpful if we can have a glance at the php code returning the results.
jerjer
2010-08-23 03:59:47
Sorry for the delays. The answer is yes, I have navigated directly to the URL and it outputs the exact HTML that I want. (it just shows the HTML). I have tested various outputs from it, but I'm here because it never seems to output anything.
gamerzfuse
2010-08-23 11:15:05
+2
A:
I'm guessing that what you want to do is update some data via $.post
then get the updated data using get? In that case you have an issue since $.post
and $.get
is asynchronous, meaning that the browser wont wait for it to finish before proceeding in the script.
What this means is that your script will call $.post
and $.get
almost simultaneously, instead, try placing your get inside the callback for $.post
like so:
$('#submit').click(function() {
var nam = $('#name').val();
var par = $("#parentCategory").val();
var dat = $("#catDate").val();
$.post("<?php echo site_url('admin/add_gallery'); ?>", {name: nam, parent: par, cat_date: dat}, function() {
if (par != 'undefined')
{
$('#next_tab').click()
}
else
{
$("#gallery").click(),
$("#name").val('')
}
$.get("http://www.example.com/admin/get_galleries", function(gals)
{ // Get the Contents of Drop Down Gallery Select
$("#galleryChoose").html(gals);
});
});
alert('yop');
});
Kristoffer S Hansen
2010-08-23 11:50:21
I will definitely look into this, as that makes sense. I believe I did try that though, however it just made things flicker and look like the page was reloading, but didn't work. I will double check it all and try to implement it properly.
gamerzfuse
2010-08-23 12:22:50
You should also check out Firebug (http://www.getfirebug.com) and see if the output you get from http://www.example.com/admin/get_galleries is the output you expect there to be. (Or, you know, just go to the address)
Kristoffer S Hansen
2010-08-23 13:24:56
As I noted on D Hoerster's answer, I used Firebug extensively and checked the URL, it sends back HTML exactly what I want.
gamerzfuse
2010-08-23 20:51:23
Didn't work, but I'm sure you were right. Substituted the completely unnecessary GET for a much simpler LOAD command.
gamerzfuse
2010-08-24 14:14:08
A:
CodeIgniter comes with $_GET disabled by default. You have to enable it in order to use it. Take a look here: CodeIgniter User Guide, Security
Luis
2010-08-23 19:54:15
Yeah, but it works perfectly fine in another section of my site where I get the cart contents using almost identical syntax.
gamerzfuse
2010-08-23 20:50:32
Maybe you are using a bad route.Make sure you are using <?= site_url('controller/method'); ?> along your requests.I think that the problem is caused by jQuery, it can't make cross domain calls(even between 'http://localhost' and 'http://127.0.0.1'). If you want to do that you need to use JSON.Hope it helps.. I had similar problem.
Luis
2010-08-24 15:45:07