JSON STRINGIFY FUNCTION
<script>
var a=window.location.hash.substr(1);
new Vue({
el: '#products',
data: {
newid:a,
tests: [
{ value: 1, text: 'pricing_matrix' },
{ value: 2, text: 'product_types' },
],
products: [],
attribute:{
id:a,
name:'',
sort_order:''
},
selected: 0,
current:'INFO'
},
methods: {
say: function (msg)
{
this.current=msg;
},
updateattribute: function () {
// alert(JSON.stringify(this.attribute));
var resource = this.$resource('http://188.166.172.244/api/v1/product');
resource.save(this.attribute)
.success(function (res) {
this.attribute='';
this.msg=res.message;
alert(JSON.stringify(res));
//document.getElementById("success").onclick();
console.log(this.attribute);
})
.error(function (err) {
//document.getElementById("warning").onclick();
alert('Product updated failed');
});
}
},
ready: function()
{
this.$http.get('http://188.166.172.244/api/v1/product/'+a)
.success(function(data) {
this.products = data;
})
.error(function(data){
console.log(data);
});
}
});
</script>
var a=window.location.hash.substr(1);
new Vue({
el: '#products',
data: {
newid:a,
tests: [
{ value: 1, text: 'pricing_matrix' },
{ value: 2, text: 'product_types' },
],
products: [],
attribute:{
id:a,
name:'',
sort_order:''
},
selected: 0,
current:'INFO'
},
methods: {
say: function (msg)
{
this.current=msg;
},
updateattribute: function () {
// alert(JSON.stringify(this.attribute));
var resource = this.$resource('http://188.166.172.244/api/v1/product');
resource.save(this.attribute)
.success(function (res) {
this.attribute='';
this.msg=res.message;
alert(JSON.stringify(res));
//document.getElementById("success").onclick();
console.log(this.attribute);
})
.error(function (err) {
//document.getElementById("warning").onclick();
alert('Product updated failed');
});
}
},
ready: function()
{
this.$http.get('http://188.166.172.244/api/v1/product/'+a)
.success(function(data) {
this.products = data;
})
.error(function(data){
console.log(data);
});
}
});
</script>
0 comments:
Post a Comment