I've found a free working script online that utilizes Ajax to reload a section (using DIV) of a page. The link to the script is here: http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm The script works fine when I use the Normal link: <a href="javascript:ajaxpage('test.htm', 'contentarea');">test</a> Code (markup): What I need is for this to work using a form and not a normal link. For example, I need it to work using a method, something like this: <input type="submit" name="Submit" value="Submit" onSubmit="javascript:ajaxpage('test.htm', 'contentarea')"> Code (markup): But the above code doesn't work. The script link shows a few other examples, including the use within a form; however, it's only for a drop-down menu inside a form. I don't need multiple options, only one when the form is submitted.
have you tried onclick? and at the end return false; [SIZE=13px][FONT=monospace]<input type="submit" name="Submit" value="Submit" onclick="javascript:ajaxpage('test.htm', 'contentarea'); return false;">[/FONT][/SIZE] [SIZE=13px][FONT=monospace] Code (markup): [/FONT][/SIZE]
Yes i see, and you want the data to submit but as hidden? and then when submitting is done? you want to replace the content? Please describe in full what you need!
Hi, I can try to help you and if I get through, you pay me? PM me the website details so I can have a look at it and explain what exactly you want done
You expect the form to perform its usuall action and the ajax to still do its job ? From what I can remember a normal form, without preventing the default method, redirects you do the attr('action') with the variables sent URIEncoded or as POST, depending on attr('method'). The reason it is NOT working, is simply because "onSubmit" works for forms, not for input elements. 1. Try this for example: <form (your attributes) onSubmit="javascript: ajaxpage('text','contentarea');"> PHP: 2. Or try my jQuery example: <!DOCTYPE html> <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#submit').click(function(e){ e.preventDefault(); $('#load').load('load_content.html'); }) }); </script> </head> <body> <input type="submit" id="submit" value="Change Content" /> <div id="load"></div> </body> </html> PHP: Create a file named load_content.html (and enter there what you need to be displayed into <div id="load"></div>