Custom Ajax call
Custom Ajax call
I need a way to use custom ajax call so I can pull data with functions for example like "data": "<?php echo strip_tags(description); ?>"
Any ideals would be greatly appreciated.
Here is the output of my test json file:
{
"DATA":[
{
"id":27,
"unique_id":"55e5e42f0d5b4",
"title":"Washer and Dryer - great running conditions",
"description":"GE washer - 2 years old and Moffat Dryer - great condition - 175$ each",
"tags":null,
"purpose":"sell",
"category":21,
"parent_category":1,
"contact_for_price":0,
"price":175,
"address":"Northridge apartment",
"phone_no":"1-705-665-8038",
"country":2,
"state":63,
"city":88,
"zip_code":"p",
"latitude":"46.5513927",
"longitude":"-81.0354982",
"featured_img":"washer.jpg",
"video_url":null,
"gallery":"[\"dryer.jpg\",\"washer.jpg\"]",
"created_by":1,
"create_time":1441129519,
"publish_time":1441129568,
"last_update_time":1442323115,
"status":1,
"activation_date":"2015\/9\/15",
"expirtion_date":"2015\/9\/18",
"featured":1,
"featured_expiration_date":"2015\/9\/18",
"report":0,
"total_view":28,
"search_meta":"Washers & Dryers Appliances Canada Ontario Greater Sudbury p Northridge apartment Washer and Dryer - great running conditions "
},
{
"id":28,
"unique_id":"55e5e513d14ac",
"title":"STOVE FOR SALE - GREAT CONDITION",
"description":"Northridge apartment Sudbury Ontario Canada white 30inch Moffat stove - only 1 year old - great condition!",
"tags":null,
"purpose":"sell",
"category":1,
"parent_category":1,
"contact_for_price":0,
"price":200,
"address":"Northridge apartment",
"phone_no":"1-705-665-8038",
"country":2,
"state":63,
"city":88,
"zip_code":null,
"latitude":"46.5513927",
"longitude":"-81.0354982",
"featured_img":"stove.jpg",
"video_url":null,
"gallery":"[]",
"created_by":1,
"create_time":1441129747,
"publish_time":1441129778,
"last_update_time":1442323093,
"status":1,
"activation_date":"2015\/9\/15",
"expirtion_date":"2015\/9\/18",
"featured":1,
"featured_expiration_date":"2015\/9\/18",
"report":0,
"total_view":32,
"search_meta":"Appliances Appliances Canada Ontario Greater Sudbury Northridge apartment STOVE FOR SALE - GREAT CONDITION "
},
{
"id":34,
"unique_id":"dddddd",
"title":"ddddd dddddd",
"description":"dddd ddddd ddddd dddddd",
"tags":null,
"purpose":null,
"category":0,
"parent_category":0,
"contact_for_price":0,
"price":0,
"address":null,
"phone_no":"1-705-665-8038",
"country":0,
"state":0,
"city":0,
"zip_code":null,
"latitude":null,
"longitude":null,
"featured_img":null,
"video_url":null,
"gallery":null,
"created_by":0,
"create_time":0,
"publish_time":0,
"last_update_time":null,
"status":0,
"activation_date":null,
"expirtion_date":null,
"featured":0,
"featured_expiration_date":null,
"report":0,
"total_view":0,
"search_meta":null
}
]
}
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Did you read the AJAX documentation?
https://datatables.net/manual/ajax
If you are looking to manipulate specific columns from the data, you can use the columns.render option.
https://datatables.net/reference/option/columns.render
Thanks! I did do some reading but I wasn't quite getting it right. But just before your post, It all came together. Thanks for pointing out the render option to me - I guess I can also clean my description string from database in my php file then create json output (server side) with PHP