0
이 스크립트가 있으므로 ../AdsCreate/CreateCar.php는 양식을 읽고 데이터베이스에 삽입하고 모든 div가 잘 작동하는 특정 div에 페이지를로드합니다.스크립트 잡기 스크립트
나는 이미지를 업로드하는 것이 하나의 문제를 안고 있는데, 그 이유는 아래의 스크립트가 데이터를 직렬화하고 파일 기반으로 처리하지 않기 때문이라고 들었습니다.
다음은 스크립트입니다. 여기
<script type="text/javascript">
jQuery(document).ready(function($) {
$("#Submit").click(function() {
var url = "../AdsCreate/CreateCar.php"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
data: $("#myForm").serialize(), // serializes the form's elements.
success: function(html){ $("#right").html(html); }
});
return false; // avoid to execute the actual submit of the form.
});
});
</script>
내가 또한 파일 업로드가있는 양식을 업로드 할 수 있도록
<form method="post" enctype="multipart/form-data" id="myForm">
<table class="default1" style="width: 100%" align="center">
<tr>
<td class="content1" colspan="3"><h3><b>Car Ads</b></h3></td>
</tr>
<tr>
<td class="content1" width="70%">Make: <input type="text" name="name"></td>
<td class="content1" width="15%">Model: <input type="text" name = "email"></td>
<td class="content1" width="15%">Year: <input type="text" name = "phone"></td>
</tr>
<tr>
<td class="content1" colspan="3">Main Photo: <input type="file" name="photo"></td>
</tr>
<tr>
<td class="content1" colspan="3"><input type="submit" value="Upload" id="Submit"></td>
</tr>
</table>
</form>
가 어떻게 스크립트를 변경할 수 있습니다 내 양식입니까 ??
만들기 : 사용자가 파일을 업로드 할 jQuery를 양식을 사용할 수 있습니다
:
AJAX 호출은 파일을 업로드 할 수 없습니다. 일반적인 해결 방법은 숨겨진 iframe을 만들고 거기에 일반 게시물을 제출하는 것입니다. –
위의 주어진 스크립트를 어떻게 추가할까요? 아주 고마워요. –