خرید بک لینک

Vote count: 0

I hava an ajax function :

$.ajax({
     url: 'my.php',
     type:'POST',
     dataType: 'json',
     data:{switch:9},
      error: function(data,e,f){
        alert("Error : "+e+" "+f);
        console.log(JSON.stringify(data));
      },

     success:function(data){
            if(data.length!=0){
              
            
                // getting the data from the array
                $.each(data, function(k, v) { 
                     // set the data from database to input box
                     $("input[name='fname']").val(v['fname']); 
                     $("input[name='bname']").val(v['bname']); 
                     $("input[name='address']").val(v['address']); 
                     $("input[name='phone']").val(v['phone_no']); 
                     $("input[name='website']").val(v['website']); 
                     $("input[name='ein_ss_no']").val(v['ein_ss_no']); 
                     $(".user-catagory").val(v['business_type']).change(); 
                });
            }
            } // End of success function of ajax 1 form

  });
This ajax function fetch data from php server in the form of json and then append the data to input text fields. This ajax function work fine some time and append the data into text fields but some it give this error "parsererror SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data". When i console it data respone it show me my whole html code like this
00:24:17.314 {"readyState":4,"responseText":"<!DOCTYPE html>n<html>n<head>n<meta charset="UTF-8">n<meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- title -->n<title></title><!-- css link -->n<link rel="stylesheet" type="text/css" href="web_assets/css/bootstrap.css">n<link rel="stylesheet" type="text/css" href="web_assets/css/custom.css"><script type="text/javascript" src="assets/js/jquery.min.js"></script>n                n        <script type="text/javascript" src="assets/js/bootstrap.min3.js"></script>n        <link rel='stylesheet' href='ASLibrary/css/style3.css' type='text/css' media='all' />n               n        <script type="text/javascript" src="assets/js/respond.min.js"></script>n        <script type="text/javascript">n            var $_lang = {"email":"Email","login":"Login","useame":"Useame","password":"Password","your_email":"Your Email","login_with":"Login With[…]1 add_profile.js:10:9

.... so on. I am totally confuse why my code is ruing and not ruing some. please if anyone know about it please help me.

asked 5 mins ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 29 ارديبهشت 1395 ساعت: 2:18

صفحه بندی