Here is simple solution.

$(document).ready(function() {
    $('#item1').click(function() {
        // access href attribute of clicked link => process.php?a=1&b=2
        var params = $(this).attr("href");
        // split href content at ? sign => process.php and a=1&b=2
        params  = params.split("?");
        // first element file name, second element url parameters
        $('#result').load( params[0] , { params[1] } );
        return false;
    });
});


I make it out quickly, maybe someone write better than this. But i think
this is good for you :-)
2007/12/4, dimmex <[EMAIL PROTECTED]>:
>
>
> Hello,
>
> I'm pretty new to jQuery and want to implement some ajax.
>
> I have a html like this:
> <a id="item1" href="process.php?a=1&b=2">click here</a>
> <div id="result"></div>
>
> After learning jQuery a little while, I got the way to call ajax
> something like this:
>
> $(document).ready(function() {
> $('#item1').click(function() {
> $('#result').load('process.php', {parameters will be passed here});
> return false;
> });
> });
>
> from what I learnt, the parameters will be passed in format: {'a' :
> value, 'b': value}
>
> My question, can I get the href part or specifically only the
> parameter (only 'a=1&b=2') and passing it and in my process.php I can
> access it just like $_POST variables ( $_POST['a'] and
> $_POST['b'] ) ?  what jQuery function do I need to do that? what I'm
> thinking is something like $('#result').load('process.php',
> extract(getparameter(url)));
>
> I hope my question is clear enough :) any help is appreciated.
>
> Thanks.
> Dimm
>



-- 
Yılmaz Uğurlu ~ jabber : [EMAIL PROTECTED]  ~ http://www.2nci.com ~ İzmir

Reply via email to