• 15-01-2019, 21:36:11
    #1
    Merhaba arkadaşlar. Böyle bir sorunla karşılaştım. Önceden hep çalışırdı fakat şimdi ne oldu bilmiyorum

    index.php dosyam
    <!DOCTYPE html>
    <html>
    <head>
    	<title>PANELAZ.COM</title>
    	<script src="code.jquery.com/jquery.min.js"></script>
    	<script type="text/javascript">
    		function yolla(){
    			$.ajax({ 
    				type: "POST",
    				url: "ajax.php",
    				data: $('#form').serialize(), 
    				error:function(){ $('#yaz').html("error"); },
    				success: function(veri) { $('#yaz').html(veri);}
    			});
    		}
    	</script>
    </head>
    <body>
    	<p id="yaz">s</p>
    	<form method="POST" id="form" onsubmit="return false">
    		<label for="">Ad: </label>
    		<input type="text" name="ad"><br>
    		<label for="">Sekil</label>
    		<input type="file" name="sekil"><br>
    		<input type="submit" name="yolla" onclick="yolla()">
    	</form>
    </body>
    </html>
    ajax.php dosyam
    <?php 
    echo "string";
     ?>
    aynı dizinde yerleşiyorlar. Ekrana string yazdırması lazım fakat yazmıyo sorun nerden kaynaklı ola bilir
  • 15-01-2019, 22:13:46
    #2
    Merhabalar bu şekilde denermisin

    <form method="POST" id="form" enctype="multipart/form-data">
            <label for="">Ad: </label>
            <input type="text" name="ad"><br>
            <label for="">Sekil</label>
            <input type="file" name="sekil"><br>
            <input type="submit" name="yolla">
         </form>
        
         <script src="http://code.jquery.com/jquery.min.js"></script>
         <script type="text/javascript">
            $(document).ready(function(){
    
                $('#form').submit(function(){
    
                  $.ajax({
                    method : 'POST',
                    url : '?',
                    data : new FormData($(this).serialize()),
                  }).done(function(response){
                    console.log(response);
                  });
    
                  return false;
                });
    
            });
         </script>
  • 20-01-2019, 20:28:42
    #3
    Çalıştı hocam teşekkür ederim