$('.aj-link').click(function(){
   var page = $(this).attr('href');
   $('#targetDIV').load('ajax/'+page+'nocache='+Math.random());
});

http://docs.jquery.com/Selectors
http://docs.jquery.com/Events
http://docs.jquery.com/Ajax

On Feb 11, 10:40 am, SoulRush <saavedra....@gmail.com> wrote:
> I though that it would be nice to make the links with a certain format
> like:
>
> <a href="ajaxProcess.php?var1=var1value&var2=var2value" class="aj-
> link"> link</a>
>
> And make a selection for that kind of links with jquery, that takes
> these data to make an ajax call with post...
>
> That selection should be in a .js outside of the source of the pages
> and packed or something...
>
> What do you think?
>
> Please I need some feedback :)
> Greetings!
>
> On 9 feb, 17:02, SoulRush <saavedra....@gmail.com> wrote:
>
> > By the way, the first parameter takes the vars to send... so in the
> > pages I've to dynamically set varname1=value1&varname2=value2....
>
> > On 9 feb, 10:40, SoulRush <saavedra....@gmail.com> wrote:
>
> > > Hi!
>
> > > I'm kind of new at the world of ajax and jquery and i'm starting to
> > > make a site with them.
>
> > > In my site i've created a single function (in the header) called
> > > ajaxQry(...) which takes some parameters like, url to make post or
> > > get, if I need GEt or POST, the data type of the query, a success
> > > function and an error function.
>
> > > Anyway, it look like this:
>
> > > function ajaxQry(sendVars, url, returnType, backFunction,
> > > errorFunction){
>
> > >          $.ajax({
> > >           type: "POST",
> > >           url: "ajax/"+url+".asp?nocache="+Math.random(),
> > >           data: sendVars,
> > >           success: backFunction, //ussully this loads the content in the 
> > > main
> > > page as html
> > >           dataType: returnType,
> > >           error: errorFunction
> > >         });
>
> > > }
>
> > > Everything works great but i don't know if there's a better way to do
> > > this, because in many events of the site I call this function... And
> > > I'm starting to think that it's pretty insecure.... What do you think?
>
> > > By the way i ussually call the url file (see the function) and return
> > > HTML content, and then i load it in the page with $(selector).html();
> > > is that okay?
>
> > > Thanks! and sorry for my english :$

Reply via email to