My json details to display details of a specific post
http://127.0.0.1:8000/listings/
{"data": {"pid": 109, "name": "Labs", "website": "service.com", "status": true}
My json details for full profile information
http://127.0.0.1:8000/profile/
{"status": true, "data": {"basic": {"name": "Kuis", "is_new": false, "is_email_verified": false, "is_phone_verified": false}, "listings": [{"pid": 109, "nams": "Labs","created_at": "2018-02-14", "validity": "2019-06-29", "views": 2, "gstno": "09485481072", "is_featured": false },{"pid": 112, "nams": "Labs12","created_at": "2018-02-15", "validity": "2019-06-29", "views": 2, "gstno": "09499481072", "is_featured": false }], "total_listings": 2}}
So now I give an editing option. So, I need to check if pid goes to profile data? How can I achieve the same?
My vue js code
mounted() {
var self = this;
data = {};
data['auth-token'] = this.authType;
$.ajax({
url: "http://127.0.0.1:8000/profile/",
data: data,
type: "POST",
dataType: 'json',
success: function (e) {
if (e.status == 1) {
self.listings = e.data.listings;
}
},
});
data = {};
data['auth-token'] = this.authType;
data['pid'] = this.pid;
$.ajax({
url: "http://127.0.0.1:8000/listings/",
data: data,
type: "POST",
dataType: 'json',
success: function (e) {
if (e.status == 1) {
self.data = e.data;
}
},
});
},
I have data in data[]and all the data from profile in listings[].
I need to compare pidin is data[]present at listings[].
I need to do the following on the side HTML
<div if="data.pid == listings.pid"> Success </div> <div v-else> Failure</div>
I am new and know only the basics. Please help me find a solution.