[jQuery] Two NewBe-Questions about jQuery

[jQuery] Two NewBe-Questions about jQuery


Hello everyone!
as mentioned above, Im quite new to jQuery (in fact I'm using it for 3
hours now ;) ).
Here are two newbe-questions which both refer to the following code:
<code>
    $(function(){
        $('#fAnfrage').submit(function(){
            var inputs = [];
            $(':input', this).each(function(){ inputs.push(this.name + '=' +
escape(this.value)); })
            jQuery.ajax({
                data: inputs.join('&'),
                url: this.action,
                type: "POST",
                timeout: 2000,
                beforeSend: function(){ $('#divAnfrage').html('<b>Bitte warten -
Ihre Anfrage wird bearbeitet.</b>'); },
                error: function(){ console.log("25:Fehler"); },
                success: function(ret){ $('#divAnfrage').html(ret);}
            })
            return false;
        })
    })
</code>
1) Question 1:
I want to submit the connected form by clicking on a textlink
(somthing like that: <input type="submit" /><a href="javascript:;"
onclick="fAnfrage.submit()">weg</a>). Is this possible with jQuery?
2) Question 2:
I validate my form in the connected php-Script which shows an
errormessage and the form with the prefilled fields in case of an
error. If I correct the mistakes and submit the form again, its not
handled by the above jQuery-Routine anymore. Why does this happen and
what can I do to submit the form through jQuery again?
Thank you very much.



































    • Topic Participants

    • tech