CodeIgniter Forums
populating dropdown from previous dropdown - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: populating dropdown from previous dropdown (/showthread.php?tid=20059)



populating dropdown from previous dropdown - El Forum - 06-26-2009

[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);              
}



populating dropdown from previous dropdown - El Forum - 06-26-2009

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


populating dropdown from previous dropdown - El Forum - 06-26-2009

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

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


populating dropdown from previous dropdown - El Forum - 06-26-2009

[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


populating dropdown from previous dropdown - El Forum - 06-26-2009

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


populating dropdown from previous dropdown - El Forum - 06-26-2009

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


populating dropdown from previous dropdown - El Forum - 06-26-2009

[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


populating dropdown from previous dropdown - El Forum - 06-26-2009

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


populating dropdown from previous dropdown - El Forum - 06-26-2009

[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?)