如何使用类型:“POST”在jsonp ajax调用 [英] How to use type: "POST" in jsonp ajax call

查看:183
本文介绍了如何使用类型:“POST”在jsonp ajax调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JQuery ajax jsonp。我有以下 JQuery代码:

I am using JQuery ajax jsonp. I have got below JQuery Code:

 $.ajax({  
        type:"GET",        
        url: "Login.aspx",  // Send the login info to this page
        data: str, 
        dataType: "jsonp", 
        timeout: 200000,
        jsonp:"skywardDetails",
        success: function(result)
        { 
             // Show 'Submit' Button
            $('#loginButton').show();

            // Hide Gif Spinning Rotator
            $('#ajaxloading').hide();  
         } 

    });  

以上代码工作正常,我只想将请求发送为POST 而非GET,请建议我如何实现此目标。

The above code is working fine, I just want to send the request as "POST" instead of "GET", Please suggest how can I achieve this.

谢谢

推荐答案

你不能使用JSONP进行POST ...它根本不起作用,它会创建一个< script> 获取数据的元素... 是GET请求。除了作为代理发布到您自己的域之外,您可以做的事情并不多,但是用户不能直接执行此操作并查看回复。

You can't POST using JSONP...it simply doesn't work that way, it creates a <script> element to fetch data...which has to be a GET request. There's not much you can do besides posting to your own domain as a proxy which posts to the other...but user's not going to be able to do this directly and see a response though.

这篇关于如何使用类型:“POST”在jsonp ajax调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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