0

I have an ajax form for settings in my site. The user presses an img and then the ajax script calls a php file called set.php. In this file I have a form

<form method="post" action="users/set.php" enctype="multipart/form-data">

If the user updates something it is ok(I have meta to user.php, although the ajax form is reset). However if he presses the button then he is directed to the file users/set.php(something really bad)

I want a suggestion on how to fix this and another one if I can send the queries without refreshing page(no jquery thank you)

Thank you

MayTheSchwartzBeWithYou
  • 1,181
  • 1
  • 16
  • 32

1 Answers1

0

You can use JavaScripts preventDefault(), or not have an action at all.

Eric
  • 371
  • 2
  • 11
  • I found the first error ok. How about the refreshing page? 'if ((!isset($_POST['hidden'])||$change==0) && $err==0){' – MayTheSchwartzBeWithYou Jul 10 '11 at 07:07
  • About the action it won't work :S, about preventDefault I will look into it but did not uderstand it. I will look it after sleep. Thank you – MayTheSchwartzBeWithYou Jul 10 '11 at 07:11
  • A. Keep the action, remove the button and just put an `a`there and attach an onClick. B. Prevent is very simple - if you place it on a link, the link won't work. If you place it on a form button, it won't submit. – Eric Jul 10 '11 at 13:40