Post an object as data using Jquery Ajax

后端 未结 6 2082
栀梦
栀梦 2020-11-28 10:24

My code that I tried is as follows:

var dataO = new Object();
dataO.numberId = 1;
dataO.companyId = 531;

$.ajax({
 type: \"POST\",
 url: \"TelephoneNumbers.         


        
6条回答
  •  隐瞒了意图╮
    2020-11-28 10:56

    [object Object] This means somewhere the object is being converted to a string.

    Converted to a string:

    //Copy and paste in the browser console to see result
    
    var product = {'name':'test'};
    JSON.stringify(product + ''); 
    

    Not converted to a string:

    //Copy and paste in the browser console to see result
    
    var product = {'name':'test'};
    JSON.stringify(product);
    

提交回复
热议问题