add this line to you ajax, see if there is any error
success : function(msg){
alert(msg);
},
error : function(request, status, error) {
if(status == 'parsererror' || status == 'error') {
alert(error);
}
}
add this line to you ajax, see if there is any error
success : function(msg){
alert(msg);
},
error : function(request, status, error) {
if(status == 'parsererror' || status == 'error') {
alert(error);
}
}
$.ajax success callback returns whatever you want it to return, you are returning a json OBJECT in this case and it appears as though you are expecting to just display a success message. Your msg variable actually contains an object, not a "Success!" string - in order to display something you will need to use msg['variable_from_json_object'] which will show that value.
Somethings I would look at as well in case its not your jquery that is causing problems in your call to utf8_encode, does this method work to convert an entire json object, or does it need to be run on each item BEFORE its converted to json? json remember is an object, its not a string.
You may look at this to get a better idea of how you can convert your array to uft8, then to json.
echo json_encode(utf8_encode_array($_rows));
with the method supplied in the link possibly..
Lastly, in order to make sure your json is being created successfully, visit the url you are call as ajax, as a normal page: include/add_edit_del.php?model=teksten_display&oper=search&ids=" + _id. of course replacing _id with a value just for testing. I think that you may see an issue here as your url should not include query parameters, they should all be in your data if you are going to use that parameter.. I would expect something of either of the following:
$.ajax({
type : "POST",
url : "include/add_edit_del.php",
data : "model=teksten_display&oper=search&ids=" + _id,
dataType: "json",
success : function(msg){
alert(msg);
}
});
OR not using the data parameter at all and cramming it into the url, because url expect NO query parameters (?var=foo), when it sees data it replaces the url parameters with values supplied within data
$.ajax({
type : "POST",
url : "include/add_edit_del.php?model=teksten_display&oper=search&ids=" + _id",
dataType: "json",
success : function(msg){
alert(msg);
}
});
Good luck!
Anyway, i got it, its CentOS 5.4, in my box: [root@www include]# php -version PHP 5.1.6 (cli) (built: Jan 13 2010 17:09:42) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies [root@www include]#
Solution: http://gargiullo.com/tag/json_encode/