Welcome Guest, Not a member yet? Register   Sign In
populating dropdown from previous dropdown
#1

[eluser]sheolikar[/eluser]
Hello sir,

I think i have not explained properly.wht i mean is populating 2nd dropdown from
first dropdown using ajax.
if i have done that but i had kept ajax function in view part and calling another
page from controller.which is not being called.

like this using get function.can anyone give suggestion for what to do.


Code:
function show_name()
{
    var position = document.getElementById("position").value;

    url = "ajax_employee.php?empid";
    ajaxcall(url);
    alert(url);    
}
function handleHttpStateResponse() {
      if (http_request.readyState == 4) {
        // Split the comma delimited response into an array
        results = http_request.responseText;        
        document.getElementById("name_id")[removed] = results;
        }
}        
function ajaxcall(url)
{
       if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

      if(!http_request){
        alert("Your Browser Does Not Support The Features Available in this script");
        return 0;
      }
      http_request.open("GET", url, true);
      http_request.onreadystatechange = handleHttpStateResponse;
      http_request.send(null);              
}
#2

[eluser]TheFuzzy0ne[/eluser]
This would have been better off posted with your original topic here - http://ellislab.com/forums/viewthread/121325/
#3

[eluser]Dam1an[/eluser]
Is there really any need to double post?

Edit: Damn Fuzz (for some reason you're post didn't appear :-S)
#4

[eluser]TheFuzzy0ne[/eluser]
I'm not sure how this ties in with CodeIgniter. Have your tried Googling for it? Probably not, so allow me http://lmgtfy.com/?q=javascript+dynamic+dropdown
#5

[eluser]Dam1an[/eluser]
or look through the forums, and that thread had actvity about 4 hours ago, so should be easy to find
#6

[eluser]sheolikar[/eluser]
since i did not got reply i thought it is ignored.actually i was trying with ajax in codeigniter.
#7

[eluser]Dam1an[/eluser]
[quote author="sheolikar" date="1246045768"]since i did not got reply i thought it is ignored.[/quote]

So anything that doesn't get answered within 2 hours is classed as being ignored?
It's good that you decided to add more information, but you could have done it in the same post, or at least in the same thread
Oh well, you'll know for next time
#8

[eluser]sheolikar[/eluser]
sure i ll keep this in mind .but could you plz tell how to do with ajax in code igniter
#9

[eluser]Dam1an[/eluser]
Nope (Not becuase I'm horrible but cause I've never tried, so can't really help)
But there was some code how to do it with ajax in that thread I refered to earlier (I'm assuming it works?)




Theme © iAndrew 2016 - Forum software by © MyBB