Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Problem in inserting data from SharePoint application page to SAP Hana db using jQuery

$
0
0

Hi,

We are trying to insert data from SharePoint application page to SAP Hana db using jQuery. I have included jQuery in the application page itself. The following jQuery is

<script type="text/javascript">
        $(document).ready(function () {
            
var requestData = "{\"empId\": \"136\" , \"empName\": \"ABC\"}";
            var URL = "http://servername:port_number/HANA_TEST_1/TestOData/ODataProj1/services/TestXS.xsodata/TestXS";

            $.support.cors = true;

            $.ajax({
                type: "POST",
                url: URL,
                username: "xxxxxx",
                password: "xxxxxx",
                data: requestData,
                contentType: "application/json; charset=UTF-8",
                success: function () { alert("Success"); },
                error: function (xhr, status) {
                    switch (status) {
                        case 404:
                            alert('File not found');
                            break;
                        case 500:
                            alert('Server error');
                            break;
                        case 0:
                            alert('Request aborted');
                            break;
                        default:
                            alert(xhr.statusText);
                    }
                }
            });
        });

    </script>

When I deployed the solution on site collection, it is giving "TypeError : Access is denied" . But this jQuery is working fine when I am using ASP.NET web application in Visual Studio 2010.

Any help is highly appreciated.

Thanks in advance.

Thanks,

Varun


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>