PHP Variable to JQuery function?

Posted by grolle on Stack Overflow See other posts from Stack Overflow or by grolle
Published on 2010-05-25T08:43:19Z Indexed on 2010/05/25 8:51 UTC
Read the original article Hit count: 247

Filed under:
|

Hi,

I need a relative path in this function:

    $(function() {
            $("#searchbox").autocomplete({
                    minLength : 2,
        source    : function (request, response){
                                $.ajax({
                                    url      : "http://linux/project/index.php/main/search/",
                                    dataType : "json",
                                    data     : { key : request.term},
                                    type     : "POST",
                                    success  : function(data){
                                    response($.map(data, function(item) {
                        return {
                            label: item.original_name,
                            value: item.original_name,
                                                            id   : item.project_id+"/"+item.folder_id+"/"+item.id
                        }
                    }))

                                           }
                            })
                            },
                    select : function(event, ui) {
                                document.location.href = "http://linux/project/index.php/projects/loaddocument/"+ui.item.id;
                             }

    });
});

How can I use a PHP Variable path to replace http://linux/project in the function above?

Best regards ...

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery