locked
Facing problem Retrieving data From Database using jQuery? RRS feed

  • Question

  • User-2018961703 posted

    Hello! I am Zain and i am facing issue related to jquery retrieving Data From Database actually i have a code and its working on localhost and getting data from database but when i upload my website on asp.net server then this code doesn't work and data didn't show can anyone help me?

    Saturday, April 18, 2020 7:27 PM

All replies

  • User-1330468790 posted

    Hi Zain,

     

    I am afraid that I cannot identify where the problem locates with the given information.

    Could you please share more details?

    such as :

    • Related codes that how you retrieve the data from database
    • The version of the framework on both your dev machine and server side
    • The error message that you received from this issue (In case you don't know how to look for the error message, you could set a few break points in the JS/C# code to check if the code working as you expected).

    These info could make the problem much easier to be targeted and thus we could solve it more efficient.

     

    Best regards,

    Sean

    Sunday, April 19, 2020 1:30 AM
  • User-2018961703 posted

    thanks for coordination Sean actually i use this code

    <script type="text/javascript">
    $(document).ready(function () {
    $.ajax({
    url: 'ViewDetail.asmx/GetBookingDetail',
    method: 'post',
    dataType: 'json',
    success: function (data) {
    $('#datatable').DataTable({
    paging: true,
    sort: true,
    searching: true,
    scrollY: 200,
    data: data,
    columns: [
    { 'data': 'datafield' },
    ]
    });
    }
    });
    });
    </script>

    • i used this code for retrieving data from database in asp.net and this code working on my localhost when i run the code in visual studio this code show me data from database but the real problem is this when i Publish my website on my hosting server then this code doesn't working and didn't show me anything.
    Sunday, April 19, 2020 9:43 PM
  • User-1330468790 posted

    Hi Zain,

     

    It seems that you are calling a web service using ajax which is common and has no problem from your code.

    Could you please check the error message?

    • How you could access the error message:

    The message could be accessed in browser. Press F12 in browser to open DevTools and you will find the error message in console tab.

    The server will return the error message if there is anything wrong from server side. The common code for the error is 404 (Not Found), 401 (Unauthorized) and 403 (Forbidden).

    We could check the reason why the problem occurs based on the error message.

     

    Best regards,

    Sean

    Monday, April 20, 2020 2:52 AM