jQuery를 사용은 : PHP에서
$.post(url, {FormData: $('#TheFormTagID').serialize()},
function(data, textStatus, jqXHR)
{
alert(data); //will alert "Something"
window.location.href = "your new page";
},
"json")
.fail(function(jqXHR, textStatus, errorThrown)
{
alert("Error: " + textStatus);
});
은 사용 $_POST["FormData"]
자바 스크립트에 결과를 얻을 양식 변수를 얻고 PHP 스크립트 echo "Something";
의 말에 할 수 있습니다.
어쩌면 몇 가지 유용한 물건 : link
편집 :
의이 말을 보자는 PHP입니다 : 다음
//Save file
//do something other
$result = new stdClass();
$result->ID = 5;
$result->FileName = "Test.jpg";
echo json_encode($result);
?>
자바 스크립트 function(data, textStatus, jqXHR)
사용과 같이이 값 :
function(data, textStatus, jqXHR)
{
alert(data.ID); //will alert 5
alert(data.FileNa,e); //will alert Test.jpg
}
전나무 st 연구하고 여기에 코드를 게시하십시오. 전에 시도한 것은 무엇입니까? –