Why wont this AJAX method work?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mcelrob5
    New Member
    • Jun 2010
    • 19

    Why wont this AJAX method work?

    I am writing an application that should query an sql server every time the application is run with parameter specified by the user. the .load() method calls for another .jsp page to be opened in a div on the main page. I believe i am calling the function correctly but it keeps giving me a null exception for the other .jsp page. The code is below and the second jsp page is stored locally with the main page.

    Code:
    jQuery("#d_results").load("Lookup_Results.jsp?date1="+date1+"&ReportType=45");
    d_results is the name of the div the div should be opened in and date1 and ReportType are parameter sent to the jsp page for the sql server query
  • ifedi
    New Member
    • Jan 2008
    • 60

    #2
    Originally posted by mcelrob5
    I am writing an application that should query an sql server every time the application is run with parameter specified by the user. the .load() method calls for another .jsp page to be opened in a div on the main page. I believe i am calling the function correctly but it keeps giving me a null exception for the other .jsp page. The code is below and the second jsp page is stored locally with the main page.

    Code:
    jQuery("#d_results").load("Lookup_Results.jsp?date1="+date1+"&ReportType=45");
    d_results is the name of the div the div should be opened in and date1 and ReportType are parameter sent to the jsp page for the sql server query
    Try:
    Code:
    jQuery("#d_results").load("Lookup_Results.jsp", "date1="+date1+"&ReportType=45");
    Also: did you say 'd_results' is the NAME of the div? I would think you should using the div's ID instead. This is actually more likely to be the problem.
    Of course I assume you have got other things right.. like 'Lookup_Results .jsp' being the correct url address.
    Cheers

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      If it's not the ID as mentioned, try the URL and see that you get the output you expect:

      http://your-url.com/Lookup_Results.j...&ReportType=45 (replacing the date with however the date is passed).
      Last edited by MMcCarthy; Jul 9 '10, 10:45 PM. Reason: Testing please ignore

      Comment

      Working...