Ajax doesnt pass get value ? |
[eluser]michal85[/eluser]
Hi there I've got some problems with my new app and hopefully someone can help me. http://www.testcms.grpx.pl/pl/advert/add Whatever I choose from "Type" I always have the same result - empty value. Advert controller Code: function getcat_by_type()
[eluser]michal85[/eluser]
Code: $(document).ready(function()
[eluser]livewirerules[/eluser]
Try this and see Code: function getcat_by_type() Code: $(document).ready(function()
[eluser]michal85[/eluser]
Code: <select name="typ" class="cat_type">
[eluser]TheFuzzy0ne[/eluser]
Step 1) Install Firefox. Step 2) Install the Firebug extension. Step 3) Profit! Firebug is extremely useful for this kind of thing. You can monitor requests to the server, and see what's being sent and what's being returned.
[eluser]michal85[/eluser]
Yeah, I know Firebug. Great tool. However I still cant figure out why my code isnt working. Firebug says that typid=1 but $this->input->get('typid') is empty. I dont understand it and I've tried many things in last hours but with no effect. Thanks for any help.
[eluser]TheFuzzy0ne[/eluser]
That's because you're posting your data via your AJAX request. You need to use $this->input->post('typid') to get the value. POST is a wiser choice for AJAX calls, since you don't have to worry about disallowed characters causing your app to throw a wobbler. With Firebug, experiment by returning data to your AJAX request. Maybe you could try passing: Code: echo json_encode($_POST); from your controller method. That should let you see what's in the post array. |
Welcome Guest, Not a member yet? Register Sign In |