Отображение txt файла с использованием jquery - PullRequest
0 голосов
/ 17 июня 2020

enter image description here

Я пытаюсь отобразить содержимое моего текстового файла, используя jquery, но у меня ошибка перекрестного происхождения. Я использую запрос на получение для отображения файла. Ниже мой код HTML, jquery, а также текстовый файл.

<html>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.1/jquery.validate.min.js"></script>
<link href="recipetwo.css" rel="stylesheet"/>
<body>
<header>
   <center>
       <h1>Butter Chicken Recipe</h1>
     <center>
       <script>
           $(function(){
             $.get("indian.txt",function(data,status) {
                    $("#butterchicken").html(data);
                    console.log(status);
             });

           });
       </script>
  </header>
  <nav>
    <ul>
    <li>
      <a href="index.html">Home</a>
    </li>
    <li>
       <a href="foodrecipe.html">Food Recipes</a>
    </li>
    <li>
       <a href="add.html">Add Recipe</a>
     </li>
    <li>
      <a href="delete.html">Delete Recipe</a>
    </li>
    <li>
      <a href='login.html'>Login Page</a>
    </li>
    <li>
    <a href="signup.html">Sign Up</a>
    </li>
  </ul>
 </nav>

<tbody id="butterchicken"></tbody>
 </table>
</body>
</html>

, а также мой текстовый файл.

Ingredients
Chicken Marinade:

 1 lb. boneless chicken breast, cut into 1 ½ inch cubes (see notes)

 2 tablespoons tandoori masala (see notes)
 1 teaspoon EACH: ginger paste and garlic paste (I used Gourmet Garden)
 ½ cup yogurt
 1 tablespoon oil
Butter Chicken Sauce:
 2 tablespoons ghee (clarified butter) (see note)
 1 large onion, thinly sliced
 1 ½ teaspoon EACH: ginger paste and garlic paste (I used Gourmet Garden)
 1 (14.5 ounce) can crushed tomatoes
 1 teaspoon chili powder (see notes)
 1 1/2 teaspoon coriander powder
 1 1/2 teaspoon cumin powder
 1/2 cup heavy whipping cream
 1/2 teaspoon garam masala
 ¼ teaspoon dried fenugreek leaves (crushed between fingers)
Instructions
Chicken:
In a medium bowl, combine the tandoori masala, ginger, garlic, and yogurt. Whisk until smooth, adjust seasonings to preference. Add the chicken and allow to marinate for at least 20 minutes and ideally for 12-24 hours, covered in the refrigerator.
Butter Chicken Sauce:
Heat the ghee in a dutch oven or heavy bottom pot over medium heat. Add the onions and sauté until they turn translucent and start to sweat, about 5-7 minutes, don't allow the onions to brown. Add ginger and garlic paste and let cook for 30 seconds, stirring so it doesn't burn. Add the can of crushed tomatoes along with the chili powder, coriander powder, and cumin powder and continue to cook for 5 minutes, if the mixture starts bubbling rapidly, add about ¼ cup of water and continue to cook.
Remove from heat, add the mixture to a blender and blend until smooth, you may need to add a couple water to help it blend (up to ¼ cup).  Depending on how powerful your blender is, you may want to blend the mixture in two batches. Remember to hold the lid of the blender down with a kitchen towel when blending, to avoid accidents.
MAKE AHEAD OPTION: At this point you can cool and refrigerate the sauce for 24-48 hours (or freeze it for up to 3 months), it will help blend the flavors even more, just remember to bring the sauce back to room temperature (use the microwave) before proceeding with the recipe OR you can continue on with the recipe immediately.
Assembly:
Heat the remaining tablespoon of oil in the dutch oven over medium heat. Add the marinated chicken (discard any excess marinade) and cook for about 5-6 minutes, stirring as required to brown all sides. Add the butter chicken sauce to the pot and heat everything through. Once it starts to bubble, add the cream and garam masala. When the sauce regains a simmer, add the crushed fenugreek leaves. Serve over basmati rice or with naan.

Придется ли мне отображать содержимое txt файла, используя сначала локальный хост, а затем вызовите этот API, используя Jquery?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...