,在$ .ajax()中抛出一个错误

时间:2011-12-23 20:17:38

标签: jquery ajax

我认为我完全有很多变量,但是我完全没有它们,因为它们对于接收POST数据的控制器都至关重要。

它打破了tv:tv,PHP Eclipse将其变为红色,但并没有告诉我问题是什么。 Chromes控制台说出了意想不到的标识符。怎么回事?

我在这些问题中到处寻找,我找不到这样的东西。

如何修复它并仍然使用所有这些表单字段?

$.ajax({
    type: 'POST',
    url: $('.pa-details-submit ul li a').attr('href'),
    data: {
        make_active_check: make_active_check,
        details_title: details_title,
        details_country: details_country,
        details_desc: details_desc,
        details_price: details_price,
        details_zipcode: details_zipcode,
        details_state: details_state,
        details_city: details_city,
        details_add: details_add,
        details_hidden: details_hidden,
        featured: featured,
        bedrooms: bedrooms,
        baths: baths,
        beds: beds,
        floor: floor,
        sleeps: sleeps,
        couches: couches,
        door: door,
        laundry: laundry,
        dishwasher: dishwasher,
        furnished: furnished,
        elevator: elevator,
        mon: mon,
        tue: tue,
        wed: wed,
        thu: thu,
        fri: fri,
        sat: sat,
        sun: sun,
        pets_allowed: pets_allowed,
        cabletv: cabletv,
        tv: tv,
        wireless_net,
        net: net,
        handicap: handicap,
        dvd: dvd,
        pay_parking: pay_parking,
        free_parking: free_parking,
        ac: ac,
        heat: heat,
        gym: gym,
        family_friendly: family_friendly,
        smoking: smoking,
        pool: pool,
        washer: washer,
        dryer: dryer
    },
    success: function(data) {
        $('.messages').html(data);
    }
});

3 个答案:

答案 0 :(得分:5)

wireless_net,

只是一个属性名称,没有赋值。

尝试:

// or whatever variable should set the 'wireless_net' property
wireless_net: wireless_net,

所以你的错误就在tv: tv,

之后

答案 1 :(得分:1)

也许是因为wireless_net没有价值。

答案 2 :(得分:1)

wireless_net没有指定参数名称。行应该是这样的:

wireless_net:wireless_net,