将json数据发送到另一个网址-从我自己的网址取回之后 [英] send json data to another url - after you've got it back from my own url

查看:112
本文介绍了将json数据发送到另一个网址-从我自己的网址取回之后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是当我单击帖子并抛出不同的URL时,我从页面获取的json的发送方式.

This is how the json I get from my page send when I clicked post, I throw a different URL.

那段数据应该看起来像这样:

That piece of data should like to come to look like this:

api.quickpay.net/subscriptions?currency=dkk&order_id=testworld&description=MB:6-testworld

但是当我让json重新观看时,是这样的:

But when I get my json back watching it like this:

{"Prices":220,"HiddenIdMedlemskab":6,"ordre_id":"6-8315042016","currency":"DKK","description":"MB: 6-8315042016"}

我应该将json放入之前添加的url中.

The json should I have shed into a url that I added earlier.

我的jquery代码如下:

My jquery code looks like this:

$.ajax({                
    type: 'post',
    url: '/Medlem/medlemskabet',
    dataType: 'json',
    data: JSON.stringify(requestData),
    contentType: 'application/json; charset=utf-8',
    async: true,
    processData: false
});

在我的网址上/Medlem/medlemskabet 那获得了我的json指定包裹价格orderid等所需的日期

Over on my url /Medlem/medlemskabet That gets the dates that I need for my json to specify package price orderid etc

所以我的问题是我如何标记有关将json扔到api URL并将其扔到其系统中的json.

So my question is How do I tag my json about throwing it over to the api URL and throws it into their system.

我是从MVC C#开始构建的

I've built since the MVC C #

推荐答案

您可以将JSON对象作为参数传递给$.get(),jQuery会将属性转换为URL参数.

You can pass the JSON object as an argument to $.get(), and jQuery will convert the properties into URL parameters.

$.ajax({                
    type: 'post',
    url: '/Medlem/medlemskabet',
    dataType: 'json',
    data: JSON.stringify(requestData),
    contentType: 'application/json; charset=utf-8',
    async: true,
    processData: false,
    success: function(response) {
        $.get('api.quickpay.net/subscriptions', response);
    }
});

这篇关于将json数据发送到另一个网址-从我自己的网址取回之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆