@asrert wrote:
[ sorry for bad english ] hi i want send a json to mysql but i get these error.
ERROR SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at Response.Body.json (http.js:1091) at SafeSubscriber._next (apis.ts:21) at SafeSubscriber.__tryOrUnsub (Subscriber.js:242) at SafeSubscriber.next (Subscriber.js:189) at Subscriber._next (Subscriber.js:129) at Subscriber.next (Subscriber.js:93) at XMLHttpRequest.onLoad (http.js:1591) at t.invokeTask (polyfills.js:3) at Object.onInvokeTask (core.js:4751)
my provider
import { Http,Response,Headers } from '@angular/http'; . . . private urlsendnote:string="http://localhost/masterfinder_api/public/addnote"; . . . addNote(credentials) { return new Promise((resolve, reject) => { let headers = new Headers(); this.http.post(this.urlsendnote, JSON.stringify(credentials), { headers: headers }) .subscribe(res => { resolve(res.json()); }), (err) => { reject(err); } }); }
and this is my page.ts
import { ApisProvider } from '../../providers/apis/apis'; . . . resposeData:any; data={"t_id": "", "m_id": "", "note": ""}; this.data.note = 'testionic'; this.data.m_id = '1'; this.data.t_id ='1'; this.apis.addNote(this.data)
Posts: 1
Participants: 1