I like to set my own attributes, like that


<a id="item1" href="javascript:;" a=1 b=2>click here</a>
<div id="result"></div>


$(document).ready(function() {
 $('#item1').click(function() {
$('#result').load('process.php', {a: $(this).attr('a'), b: $(this).attr('b') });
return false;
 });
});



hugs
Feijó


----- Original Message ----- From: "dimmex" <[EMAIL PROTECTED]>
To: "jQuery (English)" <jquery-en@googlegroups.com>
Sent: Tuesday, December 04, 2007 3:53 AM
Subject: [jQuery] calling ajax with url parameter



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

Reply via email to