json
json

Reputation: 21

AJAX call not going to the server

i am using ajax to populate a drop down but the call is not going to the server. getting the following error in fire bug

POST 0
status 404 not found

my code is:

function selectChildCategory(parent,child){
    var url = "<?php echo url::site('admin/video/showSubCategory/')?>";
    if(parent != "")
    {
            if(child != 0){
               url = url+parent+"/"+child;
            }else{
               url = url+parent+"/"+0;
            }
            $.ajax({
                url: url,
                type:"POST",
                success: function(select)
                {
                    //alert(select);
                    $("#sub_category").html(select);
                }
            });
    }
}

the parammeters are showing correct values....but call is not going to the server. The URL is correct

please advise.

Upvotes: 0

Views: 215

Answers (2)

tinyd
tinyd

Reputation: 952

Have you checked that the URL is available via a POST request?

Upvotes: 0

Dubas
Dubas

Reputation: 2876

404 Error code means that the page your are trying to call does not exists.

You are buildng a HTTP path using your parent and child variables but if the formed url does not exists (or is not captured by any mod_rewrite) a 404 error is shown.

For example, for parent "0" and child "0" the url /admin/video/showSubCategory/0/0 exists?

Also if you are using something like mod_rewrite is really correctly configured?

Try first calling the URL manually to check if the url generated by javascript really exists.

Upvotes: 1

Related Questions