Welcome Guest, Not a member yet? Register   Sign In
Refreshing a dropdown list when selecting another dropdown list.
#11

[eluser]xwero[/eluser]
You can do a check in the javascript code to see what the url looks like maybe that is the problem.
Code:
var my_url = "index.php/state/"+src+"/"+val;
alert(my_url);
// ...
url: my_url,
// ...
#12

[eluser]theighost[/eluser]
I AM GOING CRAZY the javascript is getting ignored or something....nothing appears but the HTML of the two empty dropdown lists!

not even an alert is not appearing!
#13

[eluser]xwero[/eluser]
You build the states list using ajax?
#14

[eluser]theighost[/eluser]
nope it uses php as u can see this script works on the localhost using normal php(not codeigniter)
#15

[eluser]xwero[/eluser]
Then you have two problems as i get out of you responses:

1 : the states dropdown doesn't add the state options to the states dropdown (php problem)
2 : the change event of the dropdown doesn't get registered (javascript problem)

The first thing you have to do is to check where it goes wrong with the php code, this might be a solution to the ajax generated options problem too if you use similar code.
And then you need to check/code in javascript to registration of the change event.

Without more code i can't help you further. But if you do post code please wrap it in the bbcode tag code this make reading a bit easier as i'm used to the highlighting.
#16

[eluser]theighost[/eluser]
i re arranged the javascript which wasnt colored(ignored) for some reason...now i see the alert as index.php/state/-1

it means it applies it.

now i built a function in the controller that is named state() this function loads a view which name is state.php

another function (which i apply in the url to test) is called state_dropdown() which loads the ajax script and has the connection not to the file state but to the function state that has the connection to the file state.

I hope u got me.

anyway the dropdown list remains empty!
#17

[eluser]vendiddy[/eluser]
You might have to wrap that jquery script in a $(document).ready(function { ... });
#18

[eluser]spmckee[/eluser]
Perhaps this will help: http://www.jgeppert.com/jquery-doubleselect/
#19

[eluser]hugle[/eluser]
hi,

I have done something similar you are asking, using CI and jQuery,
you can take a look here:
http://demo3.invista.lt/search/page/1/lo...requesting

If you liek it, I can share the code Smile
#20

[eluser]spmckee[/eluser]
[quote author="hugle" date="1258065297"]hi,

I have done something similar you are asking, using CI and jQuery,
you can take a look here:
http://demo3.invista.lt/search/page/1/lo...requesting

If you liek it, I can share the code Smile[/quote]

I'll bite. I've been trying to get something like that going and would love to see a working version.




Theme © iAndrew 2016 - Forum software by © MyBB