如何使用JQuery检索对表示其容器对象的变量内的div的引用?

时间:2016-03-16 17:03:16

标签: javascript jquery html dom jquery-selectors

我不是很喜欢JavaScript \ JQuery而且我有以下问题:

在页面中,我有一些<section>标签,如下所示:

<section class="com__section com__section--text functionSection">
    <div></div>
</section>

<section class="com__section com__section--text functionSection">
    <div></div>
</section>

<section class="com__section com__section--text functionSection">
    <div></div>
</section>

然后我有一个JQuery脚本选择其中一个部分(使用特定逻辑,但现在这不重要),如下所示:

var s = section.eq(i);

因此s变量包含与特定<section>标记相关的对象。

现在我的问题是,从这个 s 变量开始,我如何获得对<div>内的<section>内部using Microsoft.Owin; using Microsoft.Owin.Hosting; using Owin; using System; using System.IO; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace StackOverflowAnswer { class Startup { public void Configuration(IAppBuilder app) { app.Use<RespondToRequestMiddleware>(); } } class RespondToRequestMiddleware : OwinMiddleware { public RespondToRequestMiddleware(OwinMiddleware next) : base(next) { } public async override Task Invoke(IOwinContext context) { // Perform request stuff... // Could verify that the request Content-Type == application/json // Could verify that the request method was POST. bool isPost = context.Request.Method == "POST"; string test = null; if (isPost) { using (StreamReader reader = new StreamReader(context.Request.Body)) { test = await reader.ReadToEndAsync(); } } await Next.Invoke(context); // pass off request to the next middleware if (isPost) { // Perform response stuff... context.Response.ContentType = "application/json"; context.Response.StatusCode = 200; await context.Response.WriteAsync(test); Console.WriteLine("Response given to a request."); } } } class Program { static void Main(string[] args) { string url = "http://localhost:5000/"; using (WebApp.Start<Startup>(url)) { Console.WriteLine($"Listening on {url}..."); using (HttpClient httpClient = new HttpClient()) { string json = "{\"key\":\"value\", \"otherKey\":\"secondValue\"}"; // Typically use the extensions in System.Net.Http.Formatting in order to post a strongly typed object with HttpClient.PostAsJsonAsync<T>(url) StringContent content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = httpClient.PostAsync(url, content).Result; // IMPORTANT: use await in an async method in the real world. if (response.IsSuccessStatusCode) { string responseJson = response.Content.ReadAsStringAsync().Result; // Again: use await in an async method in the real world. Console.WriteLine(responseJson); // In your method, return the string. } else { Console.WriteLine($"Unsuccessful {response.StatusCode} : {response.ReasonPhrase}"); } } Console.ReadLine(); // keep console from closing so server can keep listening. } } } } 的引用?如何使用JQuery正确实现此行为?

1 个答案:

答案 0 :(得分:4)

也许是这样的?

$sql = "SELECT * FROM 'events' where 'date_start' = '$currentDate'";


$result= mysql_query($sql) or die(mysql_error());


print_r($result);

希望它有所帮助。