Click here to Skip to main content
12,072,534 members (59,631 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# Ajax
Hi,

I deployed the service in windows server 2008 R2

i tried to update a record in db using the service. i have used 'put' method for update.

i called the service by ajax as follows -
<script type="text/javascript">
 
        function test() {
        ;
 
            var AssetUpdate = {
              
                logInInfo: { UserName: 'mark.ritter@e-isg.com', Password: 'password' },
                asset: {
                    AssetName: 'a',
                    Barcode: '1',
                    AssetDescription: '1',
                    AssetIDInternal: 'D2907B1D-8AE9-49D8-A905-65DD356858B2',
                    PeopleIDInternal: 'ED98D0E6-4AB4-41D4-9EC2-5A289D33595B',
                    LocationIDInternal: '48A986EA-00BE-46FC-A377-C19B63DA540C',
                    AssetCategoryIDInternal: '6E41C53F-BA24-4A8B-9892-79AF133549C7',
                    SiteIDInternal: '8A63BD8B-6B1A-4C91-96E5-3DE44FF07BC0',
                    AssetUsageID: '1',
                    AssetConditionID: '1',
                    AssetStatus: '12',
                    AssetSerialNo: '123',
                    Price: '12',
                    PurchaseDate: '01/01/2012',
                    PurchaseOrderNo: '55',
                    Quantity: '456',
                    Vendor: '67',
                    IsActive: 'True',
                    AuditDate: '01/01/2012',
                    AuditStatus: '4353',
                    Asset_UID: '1',
                    DataGatherID: '34',
                    ActualCost: '345',
                    FederalCost: '435',
                    MatchCost: '324',
                    Mfg: 'TEST',
                    Model: '1',
                    POLine: '1',
                    POStatus: '1',
                    ScannerDeviceCode: '1',
                    DateModified: '01/01/2012'
                }, AssetIDInternal: '5afb3768-db2f-42d1-8c47-3da008c6cdee'
            };
 
            try {
                $.ajax({
                     url: "http://172.16.0.110:80/vamsyncservices/api/Asset/UpdateAsset",
                  
                    type: "PUT",
                    dataType: 'json',
 
                   data: AssetUpdate,
 
                    success: function () {
                        alert("Done");
                        alert('Asset Updated successfully.');
                    },
                    Failure: function () {
                        alert("Fails");
                    }
 

                });
            }
            catch (e) {
                alert(e);
            }
        }     
 
    </script>
******************************************************************************
Config file :
<system.webServer>
   <modules>
      <remove name="WebDAVModule"/>
   </modules>

**********************************************************************************

When i run the script i got an error as follows
"XMLHttpRequest cannot load http://rest.e-isg.com/vamsyncservices/api/Asset/UpdateAsset. Origin http://localhost:52265 is not allowed by Access-Control-Allow-Origin."

Help ?
Posted 9-Nov-12 3:56am
Edited 9-Nov-12 4:52am
RaisKazi34.1K
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160208.1 | Last Updated 9 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100