Well to my knowledge, the reasons I generally use $.load() is to
inject HTML dynamically into my page. Since you can pass variables in
the $.load() function you're able to do it that way, but I'm not sure
if that's the intended use of that method.

$.get('newsletter_db.php', {email: email, type: type, nom: nom},
function(responseText){
// do whatever you want on a successful ajax request
});

What problems were you encountering with the $.get() and $.post()
methods? There's also the $.ajax() method which you could use as such:

$.ajax({
url: 'newsletter_db.php',
type: 'GET',        // or 'POST'
data: {email: email, type: type, nom: nom},
success: function(responseText){
// on success callback
},
error: function(responseText){
// on error callback
}
});

On Dec 16, 10:33 am, Brandnew <[EMAIL PROTECTED]> wrote:
> Hello,
>
> i'm fairly new to the Jquery process, but i'm enjoying a lot learning
> how to use it. Lately, I made my first attempt at using a "kind of
> Ajax" page for the Newsletter of my website.
>
> I couldn't use things like $.get or $.post because I surely don't use
> them well since they don't work for me (still lot to learn). But
> instead I used "load". And so far it has been quite effective even if
> I know I'm probably not on the right path.
>
> So my question is : is it real Ajax if I use Load like this :
>
> var nom = $('.nom').val();
> var email = $('.email').val();
> var type = $('select').val();
>
> $('#html').load("newsletter_db.php", {email:email, type:type,
> nom:nom},
>      function(responseText){
>     $('#html').show(1000);
>   });
>
> Basically on the "newsletter_db.php" file, it takes the variables
> ($_REQUEST['']) and complete action with the database following what's
> been written on the form. If it's a subscription or a unsubscription,
> what's the name and the email (checked by a preg_replace). And then
> there are message if the database connection failed, or if the email
> was not written correctly, or if one input was blank...
>
> I used that technique because when I try with $.get or $.post, I
> cannot make a message appear on the screen where the user is. I mean,
> I could make an "alert('Success')" for example. But I want the message
> to come from the other page which is called. That's why I use load.
>
> Am I totally screwing up ?
>
> And if so, could you give me some clue on how to make that with $.get
> or $.post ?
>
> Thank you !

Reply via email to