-1

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

1
  • well nothing gets alerted and nothing below it gets executed Commented Apr 13, 2013 at 6:09

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

is there any minified version of the lot ?
@user1690718 There doesn't appear to be, you may have to minify it yourself.. , and if this answer solved your problem, please consider accepting it by clicking the outlined checkmark.
@user1690718: I put them together, made a few modifications to make it work with advanced optimizations, and ran it through Closure Compiler. Here's the minified result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.