Your code is confusing. Why do you have the script tag wrapped inside of the form element? Why do you have two script tags a couple tags away from each other instead of inside your header definition?
Your script is chock full of errors. Here's a couple of suggestions: 1. Move both of your script tags to inside the <head> of your document. 2. Don't define two document.ready events like you are. It's inefficient for the sake of. 3. Your form has an ID, yet you reference it by trying to find it as a child of the parent. Instead of $('#tpcsubmit').closest("form").submit(function() { Try $('#teilprojekt_create").submit(function() { 4. There's no need to declare the "optionstpcsubmit" variable like you are. For a couple reasons: 4a. You're defining references to functions before they exist! You have beforeSubmit being set to a function reference for before_tpcsubmit, but that function isn't defined to later inside the script, meaning it's undefined. 4b. You can easily solve all your problems by restructuring your code to put the object directly inside the plugin call. (This will solve the functions being undefined thing as well). $(this).ajaxSubmit({ beforeSubmit: before_tpcsubmit, success: complete_tpcsubmit, timeout: 3000, target: '#target' }); 5. Along the same vein as #4, you're declaring functions unnecessarily. You could be doing a lot better by using lambda functions. $(this).ajaxSubmit({ beforeSubmit: function() { $('#inicator').show(); } , success: function() { $('#inicator').hide(); $("#target").effect("slide",{ },2000); }, timeout: 3000, target: '#target' }); 6. Calling javascript:void(0) is, imo, pretty archaic, especially with jQuery at your disposal. Make the href="#", then just restructure your click event to the following: $('#testlink').click(function(){ $("#tpanlegen").effect("slide",{}, 2000); }); 7. Try to use some kind of human-readable naming schema. itsnoteasytoreadavariablewheneverythingisjustcrammedinthere. (ItsWayEasierToReadAVariableIfYouCamelCaseIt) 8. Don't make variable names as long as the previous example. Remember, with javascript, size matters. The smaller your file, the faster it can be transmitted. The less meaningless declarations and scruff code you have, the easier it will be to maintain. On Jun 26, 9:46 am, fredrik <carl.fredrik.bonan...@gmail.com> wrote: > Hum, sorry not on top of my head. > > I'll try your code when I get home. > > ..fredrik > > On Jun 24, 6:39 pm, jogep <joh...@googlemail.com> wrote: > > > > > when I try your code the form will still executed twice. > > The Alert tells me 1 closest form . > > > Any other Idea? > > > Thank You > > Johannes > > ------------------------------------------------- > > web:http://www.jgeppert.com > > twitter:http://twitter.com/jogep > > > On 24 Jun., 16:01, fredrik <carl.fredrik.bonan...@gmail.com> wrote: > > > > What happens when you tie the event to the form instead of the submit > > > button: > > > > $('#teilprojekt_create').submit(function(e) { > > > e.preventDefault(); > > > $(this).ajaxSubmit(optionstpcsubmit); > > > > }); > > > > If that doesn't work, see what the length of $('#tpcsubmit').closest > > > ("form") is. > > > > console.log($('#tpcsubmit').closest("form").length)) > > > or > > > alert($('#tpcsubmit').closest("form").length) > > > > ..fredrik > > > > On Jun 24, 3:47 pm, jogep <joh...@googlemail.com> wrote: > > > > > thanks for fast response. > > > > > Sorry but the form was still executed twice. > > > > > Best Regards > > > > Johannes Geppert > > > > > ------------------------------------------------- > > > > web:http://www.jgeppert.com > > > > twitter:http://twitter.com/jogep