angular 2 http.get 到 php 文件没有响应

No response from angular 2 http.get to php file

我的 angular 2 http.get 中的某些内容不正确,但是,我不明白那是什么。

我尝试将 3 个输入字段数据从常规格式发送到 ajax.php 服务器文件,并通过 echo 命令提醒服务器的响应。这样我就可以确保通信正常进行。当 chrome 扩展程序与 ajax.php 服务器文件正确通信时(有正确的 json 响应),我的 angular 应用程序中的代码提醒响应 [object object]只要 。将对象解析为数据不起作用。有时反应是空白的。这是我的 angular 代码: 第一个文件 - contact.component.ts ,方法 onSubmit() :

onSubmit(form:any)
    {
        this.name = form.value.name;
        this.email = form.value.email;
        this.mobile = form.value.mobile;
        /* ajax call*/
        alert(this.name+this.email+this.mobile);
     alert(this.authService.send_lead_information(this.name,this.email,this.mobile));
    }
    second file - auth.service.ts :

    import { Injectable } from '@angular/core';
    import {Http, Response} from "@angular/http";
    import any = jasmine.any;

    @Injectable()
    export class AuthService {
        constructor(private http:Http) {}

        send_lead_information(name,email,mobile)
        {
            return this.http.get('http://wwww.delikates.co.il/ajax.php?name='+name+'&email='+email+'&mobile='+mobile)
                .subscribe((data:Response)=>data.json()
                );
        }
    }

响应应作为 json 对象出现在浏览器的警报消息中: {邮件:丹尼尔贡塔@gmail.com}。 chrome 扩展正确显示了服务器的响应。

您在 URL 中输入了 "wwww" 中的四个编号,从您尝试获取的位置开始。

this.http.get('http://wwww.delikates.co.il/ajax.php?name='+name+'&email='+email+'&mobile='+mobile)

试试这个,它正在工作我检查过:

 return this.http.get('http://www.delikates.co.il/ajax.php?name='+name+'&email='+email+'&mobile='+mobile)
        .subscribe((data:Response)=>data.json()
        );