> 백엔드 개발 > PHP 튜토리얼 > 请教我的代码中的问题 ajax+php(CodeIgniter)

请教我的代码中的问题 ajax+php(CodeIgniter)

WBOY
풀어 주다: 2016-06-23 14:16:16
원래의
1133명이 탐색했습니다.

我用ajax将页面的值传递到后台,但是却无法获取,请教下我这个该怎么写呢?麻烦大牛们了。

我的页面代码为:
<script> <br /> $(function() { <br /> $("form[name='estimate']").submit(function(e) { <br /> e.preventDefault(); <br /> var btn = $("form[name='estimate']").find("input[type='submit']"), <br /> price = $(this).find(".price"); <br /> btn.button('loading'); <br /> price.html(""); <br /> $.ajax({ <br /> type: "POST", <br /> url: '<?php echo base_url(); ?>index.php?module=testprice&view=getprice', <br /> data: $(this).serializeArray(), <br /> success: function(data) { <br /> price.html("<h3>$" + data + " RMB<h4>" + ""); <br /> btn.button('reset'); <br /> }, <br /> error: function() { <br /> alert("Service Unavailable"); <br /> } <br /> }); <br /> }); <br /> <br /> </script>    



    

        

            

                

                    

                        

                            

估算


                        

                    

                    

                        

                            

                                

计算成本


                                

                                    

                                        

                                            

                                                
                                                  
                                                
                                            

                                        

                                    

                                

                                

                                    

                                        

                                            
                                            

                                                
                                            

                                        

                                    

                                    

                                        

                                            

                                                
                                                

                                                    

                                                        
                                                        kg
                                                    

                                                

                                            

                                        

                                        

                                            
                                            

                                            

                                                
                                                cm
                                            

                                            x
                                            

                                                
                                                cm
                                            

                                            x
                                            

                                                
                                                cm
                                            

                                        

                                    

                                

                                

                                    

                                        

                                            

                                                
                                            

                                        

                                    

                                    

                                

                            

                            

                                
                                

                                

                            

                        

                    


                


            

        



我的后台代码如下:
 function getUserPrice() {
        $tozipcode_t = $_POST('postal_code');

}

我这里无论怎样都无法获取值,请大牛帮忙分析一下,多谢多谢了

回复讨论(解决方案)

$tozipcode_t = $_POST['postal_code'];

十分感谢。我真的很多不会,以后多和您请教了。

원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿