mega-crazy
mega-crazy

Reputation: 858

php.js not able to function properly

im trying to use the php.js with my scripts but it wasnt working so i ironed out a function and loaded onto a single page with nothing but the jquery and php.js but still it isnt working

 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="./pathinfo_function.js"></script><script> 

    $(document).ready(function() {

         $(".do").click(function() {

    alert(pathinfo('/www/htdocs/index.html', 'PATHINFO_EXTENSION'));
        });

    });

    </script>

    <a href='#' class='do'>Pathinfo</a>

It gets all broken, could anyone point out what im doing wrong

Upvotes: 0

Views: 63

Answers (1)

Daedalus
Daedalus

Reputation: 7722

Well, you should always check the console whenever debugging code.. Chrome has it when inspecting elements with right-click, firefox has it with the firebug extension, and IE has it with F12.. To the point, however..

The function you are attempting to use depends on two other functions.. as specified right in the header of the code on lines 16 and 17. It depends upon.. basename and dirname. Include both of those functions in your code, and it should then work.

//basename function..
//dirname function..
//pathinfo function..

$(document).ready(function() {
    $(".do").click(function() {
        alert(pathinfo('/www/htdocs/index.html', 'PATHINFO_EXTENSION'));
    });
});

Working demo

Upvotes: 1

Related Questions