如何在Cakephp中的表单的编辑部分中根据国家显示状态? [英] How Can I Show State According To Country In Edit Section Of A Form In Cakephp?
本文介绍了如何在Cakephp中的表单的编辑部分中根据国家显示状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我第一次打开这个编辑部分时会出现这个错误。如果在编辑部分我点击状态下拉列表,所有状态都将来临。它应该像国家一样来到国家。但点击后另一个state.it很好。我该怎么办?
in edit.ctp
< script src =js / jquery.min.1.8.3.jstype =text / javascript>< / script>
函数 showFields(id)
{
var strURL = ' <?php echo HTTP_ROOT; ?>'跨度>;
var image = <?php echo HTTP_ROOT。'img / ajax-loader-small.gif';?>
$(' #loader')。html( < img src =' + image + '/>);
$ .post(strURL + 场地/ ajaxstate,{ country:id}, function (data){
if (data){
$(' #result')。html(data);
$( #loader )。hide();
}
else
{
alert( 错误......);
}
});
}
解决方案
(' #loader')。html( < img src =' + image + '/>);
.post(strURL + 场地/ ajaxstate,{ country:id}, function (data){
if (data){
(' #结果跨度>)HTML(数据);
This mistake is coming when first time i am going to open this edit section.i.e if in edit section i am clicking upon state dropdown all the states are coming.It should come like states according to a country.but after clicking upon another state.it is coming fine.so what can i do?
in edit.ctp
<script src="js/jquery.min.1.8.3.js" type="text/javascript"></script>
function showFields(id)
{
var strURL = '<?php echo HTTP_ROOT; ?>';
var image = "<?php echo HTTP_ROOT . 'img/ajax-loader-small.gif'; ?>"
$('#loader').html("<img src='"+image+"' />");
$.post(strURL+"venues/ajaxstate",{"country":id},function(data){
if(data) {
$('#result').html(data);
$("#loader").hide();
}
else
{
alert("Error...");
}
});
}
解决方案
('#loader').html("<img src='"+image+"' />");
.post(strURL+"venues/ajaxstate",{"country":id},function(data){ if(data) {
('#result').html(data);
这篇关于如何在Cakephp中的表单的编辑部分中根据国家显示状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文