Hello Everyone,
When i clicked delete button
function RemoveFavorite(obj)
{
if (confirm('Ürün Favorilerizden Çıkarılacak. Emin Misiniz?')) {
$.ajax({
type: 'POST',
data: {userFavoriteId: obj},
url: '/testdrive/index.php/shopping/RemoveFavorite',
success: function(data) {
$('#userFavDiv').html(data);
},
error: function(data)
{
}
});
}
}
this function will call.
and then
$Id = $_POST['userFavoriteId'];
$model = UserFavorite::model()->findbyPk($Id);
$model->delete();
echo CJSON::encode($this->renderPartial('/shopping/userFavorite'),true,false);
this code will run. cjson encode return me like
<meta charset="utf-8">
<section class="other-books subsection divider-top-thick">
<h3>Favoriler</h3>
<table class="table table-striped table-header">
<tr style='background-color: #999999'>
</tr>
<tbody>
<tr>
<td>
<a href="/testdrive/index.php/book/bookDetail?bookId=6">URFA SAVAŞINDAN YAPRAKLAR</a>
</td>
<td>
<a class="cart-item-remove-option icon-trash" title='Favorilerden Çıkar' href="#" onclick="RemoveFavorite('53');">
</a>
</td>
</tr>
</tbody>
</table>
</section>
<script>
function RemoveFavorite(obj)
{
if (confirm('Ürün Favorilerizden Çıkarılacak. Emin Misiniz?')) {
$.ajax({
type: 'POST',
data: {userFavoriteId: obj},
url: '/testdrive/index.php/shopping/RemoveFavorite',
success: function(data) {
$('#userFavDiv').html(data);
},
error: function(data)
{
alert('Onaylanmadı!!');
}
});
}
}
</script>null
Did you see null string end of the respond data? How can i fixed?