weixin_33709219 2014-06-12 05:36 采纳率: 0%
浏览 67


JSON Array not returning object instead returning value

HI friends i have a scenario wherein the user enters his memberid i do a jquery ajax with memberid and fetch the details related to him and put it in a textbox ,

It was working fine on my server when the code is deployed to other server i'm not getting the result

the code is as shown below

  1. createaccount.php

                <title>Century Club</title>
            <link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
            <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
                <link href="css/century-club.css" rel="stylesheet">
            <script src="js/jquery-1.4.2.min.js" type="text/javascript" charset="utf-8"></script>
                <script type="text/javascript">
                    function check()
                        var mid = $("#memberid").val();
                        var dataString = "mid=" + mid ;
                                type: "POST",  
                                url: "getdetails2.php",  
                                datatype: 'json',
                                data: dataString,
                                beforeSend: function() 
                                success: function(data)
                                        $.each(data, function (i,member) {
                    }//End of SecureLogin 
                <div class="container">
                        <div class="menu">
                        <span class="nav_top"></span>
                        <div class="clr"></div>
                            <nav id="menu-wrap">    
                 <div class="container">
                    <div class="register">
                     <div class="row">
                    <div class="col-xs-12 col-md-9">
                         <div class="matter"><div style="clear:both; height:15px;"></div>
                <center><h1>Create New Account</h1></center>
                <div style="clear:both; height:8px;"></div>
                     <div class="join-club">
                        <h4 class="join-heading">Century Club - Create Account <br><span class="legend"><font color="#FF0000"><font class="red"> *</font></font> indicates a mandatory field</span></h4>
                <div align="center" id="status" style="display:none">
                        Just Wait a Moment..</div>
                        <div id="process" class="process"></div>          
            <form id="register" name="register"   method="POST">            
                 <table class="join-members" width="100%" style="margin:10px 0 0 0; ">
                        <td width="47%"><span>User Name (Membership Account No.)<font class="red"> *</font></span>
                            <p>(Example : abcd1234)</p>
                        <td colspan="2">
                            <input   type="text" name="memberid" id="memberid"  Maxlength="15"
                            value="<?php if(!empty($memberid)) echo $memberid;?>" autocomplete="off"  style="width: 95%;
                        padding: 6px;" class="email2"  onblur="check();"   /></td>
                    <td><span>Name <font class="red"> *</font></span></td>
                        <td colspan="2"><input  type="text" name="name" id="name"  readonly
                        value="<?php if(!empty($name)) echo $name;?>"  class="email"/></td>
                        <td >
                        <td colspan="2">  <input type="submit"   name='submit_req' value="Submit" class="button"  style="margin:0"  /> </td>
                        <div class="clr"></div>

JSon response file getdetails2.php


    $query="Select member_id,member_name,office_number,mobile_number,Residence_number from cm_details where member_id='$mid'";

    //while loop starts here buddy
            $rows[] = array("name" => $mname);
        }//end of while loop here

    @header("Content-type: application/json");
    echo json_encode($rows);

As far as the analysis made it is treating the JSON response as an object in my server where the code works fine but in the other server it doesnt treate it as an object

And one more error i noticed is

 Uncaught TypeError: Cannot use 'in' operator to search for '182' in

Thats all i could do guys i feel like JSON is not identified by the server something like that help me guys expecting your answers as soon as possible

  • 写回答



      相关推荐 更多相似问题


      • ¥15 GEO下载数据的处理报错 :函数‘Meta’标签‘"data.frame"’找不到继承方法,如何解决?
      • ¥15 DLNM模型是否可以用二分类变量作为y变量
      • ¥15 android object box 一个实体多个表怎么写
      • ¥15 temux 启用docker 服务失败
      • ¥15 Flask 使用celery发送邮件出现‘目标计算机积极拒绝‘
      • ¥60 老人用的sd卡在手机里面不知道操作了什么,导致图片和视频变成了文件,取下sd卡连接电脑就是图中的样子,后缀改为.jpg才可以,需要用系统的画图软件才能打开,文件属性还是文件,有没有批量操作的解决办法
      • ¥15 超时跳出方法代码的返回值问题
      • ¥15 汇编语言程序设计设计,ascii码求数,再求数的BCD码
      • ¥30 Mask rcnn训练自己的数据集出现问题!
      • ¥20 研究人工智能时的几个问题