How do I use jQuery s ajax method to fetch data from the database to populate an array? 30

Updated on technology 2024-05-14
15 answers
  1. Anonymous users2024-02-10

    .ajax({

    url: '',type: 'get',datatype: 'xml',timeout: 1000,error: function(){

    alert('error loading xml document');,success: function(xml){ The method that is executed when it returns normally.}

    Do Something with XML return values can be written as strings or as XML.

    It is best to write it in XML format and return it to JSP

    There are many examples on this web that you can look for, and it's simple.

  2. Anonymous users2024-02-09

    jQuery Ajax depends on the server language to query the database, jQuery can use $.post("url",,function(data));Of course, you can also use $ajax method to make asynchronous transfer requests.

  3. Anonymous users2024-02-08

    Aren't you looking to query the database in the background? ajax is to do data interaction in the backend, you query this field in the background, use ajax interaction, and return the value you queried to the foreground, either return null or"", or return a valued;

    Then write your logic in the success function of ajax, and it's OK; Do you know how to use ajax?

    ajax(,error : function(result)

  4. Anonymous users2024-02-07

    Of course, you can make an ajax request, and then you will do the corresponding operation according to the result of the request.

  5. Anonymous users2024-02-06

    Your needs are not too clear,]

    You can produce a JSON array like this.

    var data=eval('(' + msg + ')');

    alert(data[0].a);Take one....

  6. Anonymous users2024-02-05

    The main ** ah, who knows how you wrote the amount?

  7. Anonymous users2024-02-04

    1. Use alert(array) to see if the obtained array is [object], if not.

    If the string of this array pops up;

    2. Then var array=eval("("+array+")");

    Re-array[0]["title"] to get it.

    3. Generally, if the returned array is not in JSON format, then it needs to be converted to JSON format;

  8. Anonymous users2024-02-03

    One way is to use eval() to deal with it, but I recommend that you convert the data to JSON format when PHP returns, so that the AJAX function can manipulate the data directly.

  9. Anonymous users2024-02-02

    It's very simple, if the data is a string, then you just use the function eval

    For example: var array = eval(data); And then you just use the array normally, and your data[0] above is array[0].

  10. Anonymous users2024-02-01

    You can look at the jquery and it is very clear. Reference.

  11. Anonymous users2024-01-31

    jQuery Ajax relies on the server language to query the database. jQuery can be used.

    post("url",,function(data));

    Of course, you can also use $ajax method to make asynchronous transfer requests.

  12. Anonymous users2024-01-30

    There are many methods, which can be separated by commas, or you can use json (recommended).

  13. Anonymous users2024-01-29

    Your needs are not too clear,]

    You can produce a JSON array like this.

    var data=eval('(' + msg + ')');

    alert(data[0].a);Take one....

  14. Anonymous users2024-01-28

    It can be done directly in this form.

  15. Anonymous users2024-01-27

    Assumptions: 1. Your page is under web-root, and the content is:

    The encoding used is UTF-8

    2. Your servlet is: The mapping path is servlet helloworldservlet

    Steps: 1. Introduction.

    2. Write the click trigger function of the input box with ID as username

    #username").keyup(function(),error: function()

    3. Background processing of the received content:

    utf-8");

    string username = "username");

    utf-8");

    pringwriter out = ;

    Note: 1. The encoding here is unified as UTF-8

    2. Request path servlet helloworldservlet is a relative path, so your page must be under the web-root of the project (that is, under the default web folder, the name may change due to different project configurations).

    3. No, remember to give points, typing is very hard

Related questions
17 answers2024-05-14

Ingredients: 1 cup flour (regular disposable cup.

Size. About 60 grams), 3 eggs, 1/2 cup of milk (half of flour), some sugar (I add it to taste, if you want.) >>>More

16 answers2024-05-14

Referring to Wuzhen and Xidi, the lights create an atmosphere, and the food gathers popularity!

9 answers2024-05-14

Because your D drive may be in NTFS format.

13 answers2024-05-14

This has backgammon source code. In addition, you can chat online for details.

12 answers2024-05-14

Click "Start" - "Run" in the bottom left corner of the desktop, and then type "DXDIAG" Enter, which will launch the DirectX diagnostic tool, and you can see the current version number to the right of the "DirectX Version" entry in the lower part of the "System" tab. >>>More