Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> problem z przesłaniem inputa file ajax
inomi13
post 31.12.2021, 10:23:58
Post #1





Grupa: Zarejestrowani
Postów: 95
Pomógł: 0
Dołączył: 16.08.2017

Ostrzeżenie: (0%)
-----


Witam mam poniższy skrypt, który przesyła wszystkie wartości z inputów, jednak mam problem z inputem, który ma type "file". Nie wiem jak się do tego zabrać sad.gif Proszę o pomoc w rozwiązaniu problemu.
  1.  
  2. $(document).ready(function(){
  3. $("#register-form").submit(function(event){
  4. submitForm();
  5. return false;
  6. });
  7. });
  8.  
  9. function submitForm(){
  10. $.ajax({
  11. type: "POST",
  12. url: "register-form.php",
  13. cache:false,
  14. data: $('form#register-form').serialize(),
  15. success: function(response){
  16. if(!response){
  17. $("#register-modal").modal('hide');
  18. }
  19. else{
  20. $("#error").html(response)
  21. }
  22. },
  23. error: function(){
  24. alert("Error");
  25. }
  26. });
  27. }


Ten post edytował inomi13 31.12.2021, 10:26:01
Go to the top of the page
+Quote Post
Neutral
post 31.12.2021, 23:48:32
Post #2





Grupa: Zarejestrowani
Postów: 286
Pomógł: 46
Dołączył: 10.01.2016

Ostrzeżenie: (0%)
-----


Zgaduję, dla typu file, wyślij Ajaxa typem file. Domyślnie masz post.

Ten post edytował Neutral 31.12.2021, 23:49:39
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 19.04.2024 - 14:07