, 즉 .. 다음 숨겨진 입력의 무리와 함께 직렬화 및 PHP 파일로 전송됩니다 어떻게 든이 라인?JQuery와 직렬화에 encodeURIComponent 내가 양식 입력을 인코딩 URI 필요
로에 encodeURIComponent를 결합 할 수 있습니다var landingCreate = $(this).serialize();
UPDATE :
var landingCreate = $(this).serialize()+"&enc="+encodeURIComponent($('input[name=\'longform\']').val());
및 URL을 입력 :
예 이렇게
http://www.smashingmagazine.com/2008/10/13/pricing-tables-showcase-examples-and-best-practices/
텍스트 상자에 변경되지 않은 URL을 반환합니다 .. 모든 대시와 슬래시 등을 16 진수 코드로 변환해서는 안됩니까?
UPDATE 여기
전체 코드입니다.
<form id="createTokenLanding">
<input type="text" name="longform" />
<input type="hidden" name="domain" value="<?php echo rawurlencode($_SERVER['HTTP_HOST']); ?>" />
<input type="hidden" name="useragent" value="<?php echo rawurlencode($_SERVER['HTTP_USER_AGENT']); ?>" />
<input type="hidden" name="ip" value="<?php echo rawurlencode($_SERVER['REMOTE_ADDR']); ?>" />
<input type="hidden" name="cookieuser" value="<?php echo rawurlencode($_COOKIE['littlr_user']); ?>" />
<input type="submit" name="submit" value="Shorten" />
</form>
<div id="result">
123
</div>
<script type="text/javascript">
$(document).ready(function(){
$.ajaxSetup ({ cache: false });
$('#createTokenLanding').submit(function() {
var landingCreate = $('#createTokenLanding').serialize();
$.ajax({
url: 'action-create.php',
data: landingCreate,
success: function(responseText){
$('#result').html(responseText);
}
});
return false;
});
});
</script>
패스 URI 인코딩하려는 입력이 사용자에 의해 입력되었거나 숨겨진 입력입니까? –
사용자가 입력했습니다. – Gary
"longform"은 "this"형태입니까? Ajax 용 데이터를 보내기 위해 이벤트 제출을 사용하고 있습니까? –