I want communication by JSFIDDLE (jQuery AJAX call => url:…) with PHP code in my server but have following error.
An error has occured:
[object Object]
error
Demo: http://jsfiddle.net/mmJNq/
what do i do?
$ ('.eghamat').live('keyup', function () {
var $ this = $ (this),
$ div = $ this.closest('div.bg_units'),
bu_num = '.' + $ div.attr('class').split(" ")[1];
var dataObj = $ (this).closest('form').serialize();
//alert(dataObj);
$ .ajax({
type: "POST",
dataType: 'json',
url: 'http://binboy.gigfa.com/admin/tour_foreign/auto_complete',
//url: 'auto_complete',
data: dataObj,
cache: false,
success: function (data) {
//alert(bu_num);
var id_name = $ (bu_num + ' .list_autobox_hotel').attr('id');
$ (bu_num + ' .list_autobox_hotel').show().html('');
if (data == 0) {
$ (bu_num + ' .list_autobox_hotel').show().html('<p><b>there is no</b></p>');
} else {
$ .each(data, function (index, value) {
$ ('<p id="' + value.name + '">' + value.name + '</p>').appendTo('.list_autobox_hotel');
});
}
},
"error": function (x, y, z) {
// callback to run if an error occurs
alert("An error has occured:\n" + x + "\n" + y + "\n" + z);
}
});
});