폼이 있고 그 결과를 div에로드하려고합니다. 나는 이미 이것에 대한 몇 가지 주제를 검색했습니다. 그리고 나는이 하나가 작동한다고 생각했지만 그럴 수는 없습니다.div 안에 폼 액션로드하기
이 내 코드는 지금까지 있습니다 :
<script type="text/javascript"> $('#form').submit(function() { // catch the form's submit event
$.ajax({ // create an AJAX call...
data: $(this).serialize(), // get the form data
type: $(this).attr('method'), // GET or POST
url: $(this).attr('action'), // the file to call
success: function(response) { // on success..
$('#test').html(response); // update the DIV
}
});
return false; // cancel original event to prevent form submitting }); </script>
<DIV id="test"></DIV>
<FORM id="form" name="pcc" method="post" action="http://wl.breedbandwinkel.nl/postcodecheck" onSubmit="return validatePcc(this);">
<div class="one_third firstcols">
<H4>Ik ben op zoek naar:</H4>
<DIV class="ff"><INPUT type="radio" class="pccrad radio" name="sub" value="alles-in-een-pakketten" id="pcc-alles-in-een-pakketten" onclick="$('#pcc-no').hide(); $('#pcc-fpcon').css('visibility', 'visible'); if($('#pcg').val() == '') $('#pcg').focus();"><LABEL class="left pcm" for="pcc-alles-in-een-pakketten" onmouseover="mpopup('Alles-in-één pakketten','Extra voordelig pakket met internet, digitale telefonie en/of digitale televisie.');" onmouseout="kill();">Alles-in-één pakketten</LABEL></DIV> <DIV class="ff"><INPUT type="radio" class="pccrad radio" name="sub" value="internet" id="pcc-internet" onclick="$('#pcc-no').hide(); $('#pcc-fpcon').css('visibility', 'visible'); if($('#pcg').val() == '') $('#pcg').focus();"><LABEL class="left pcm" for="pcc-internet" onmouseover="mpopup('Internet','Altijd supersnel onbeperkt online tegen een vast bedrag per maand.');" onmouseout="kill();">Internet</LABEL></DIV> <DIV class="ff"><INPUT type="radio" class="pccrad radio" name="sub" value="digitale-televisie" id="pcc-digitale-televisie" onclick="$('#pcc-no').hide(); $('#pcc-fpcon').css('visibility', 'visible'); if($('#pcg').val() == '') $('#pcg').focus();"><LABEL class="left pcm" for="pcc-digitale-televisie" onmouseover="mpopup('Digitale Televisie','Geniet van haarscherp digitaal beeld en geluid inclusief de gratis digitale programmagids.');" onmouseout="kill();">Digitale Televisie</LABEL></DIV>
</div><!-- end .one_third -->
<div class="one_third">
<H4>Mijn postcode en huisnummer zijn:</H4>
<TABLE border="0" cellspacing="0" cellpadding="0">
<TR>
<TD height="14" colspan="2">Postcode</TD>
<TD>Huisnr.</TD>
</TR>
<TR>
<TD width="51"><INPUT type="text" class="text" maxlength="4" size="5" value="" name="pcg" id="pcg" onKeyUp="autoTab(event,this,4,pcl);" onFocus="chBg(pcc,'pcg');" onBlur="chBg(pcc,'reset');" style="width: 41px;"></TD>
<TD width="46"><INPUT type="text" class="text" maxlength="2" size="2" value="" name="pcl" id="pcl" onKeyUp="autoTab(event,this,2,hn);" onKeyDown="backSpace(event,this,pcg);" onFocus="chBg(pcc,'pcl');" onBlur="chBg(pcc,'reset'); upperCase(event,this);" style="width: 26px;"></TD>
<TD width="36"><INPUT type="text" class="text" maxlength="6" size="4" value="" name="hn" id="hn" onKeyDown="backSpace(event,this,pcl);" onFocus="chBg(pcc,'hn');" onBlur="chBg(pcc,'reset');" style="width: 36px;"></TD>
</TR>
</TABLE>
<U class="dot small" onmouseover="popup('Waarom mijn postcode invullen?','Om te kunnen controleren welke abonnementen op uw adres leverbaar zijn hebben wij uw postcode en huisnummer nodig.<br>Uiteraard respecteren wij uw privacy. Deze gegevens worden niet opgeslagen.');" onmouseout="kill();">
Waarom mijn postcode invullen?</U>
</div><!-- end .one_third -->
<div class="one_third lastcols">
<INPUT type="submit" name="submit" value="Vergelijk de aanbiedingen op uw adres" class="button">
</div><!-- end .one_third -->
</FORM>
그래서 나는이 작동하지 않는 것을 알아 냈어. 액션 URL (
http://wl.breedbandwinkel.nl/postcodecheck)의 결과를 에 표시하고 싶습니다. 현재 iframe 내에서이 작업을 수행하고 있지만 '전문가'모양이 아닙니다. 나는 알지 못하면 충분한 정보를 주었으면 좋겠다.
왜 연결하는 것이 다른 예를 작동하지 않았다 : PHP에서 게시물 코드 검사기를 가정하면 ajaxActions.php 파일은 다음과 같이 보일 것입니다, GET 요청을 받아 들여? jquery js 파일을 스크립트로 포함 시켰습니까? HTML의 헤더에 을 작성하십시오 (물론 따옴표와 함께 올바르게 형식을 지정하십시오). ...) –
나는 당신이 나에게 말한 것을 방금했으나 여전히 작동하지 않습니다. 내가하고있는 일의 예를 보려면 여기를보십시오. http://www.kabeladviseur.nl/test/ – Mark
Alles-in-één pakketten을 클릭하고 " 우편 번호 "1234 AA와"Huisnr. " 1. – Mark