jquery - Send an Ajax request based entirely on the outcome of a first ajax request -


I am not surprising on jQuery, though I am creating a system from which the user selects from a stable category Launches an Ajax Request (especially a .load) that returns data in a second selection statement.

This works perfectly for my purposes. I am having difficulty with the selection of this second SELECT statement to run the second Ajax request. There is no output with the second request, it does not appear in the fire

Please tell me how can I improve my jQuery and how can I make the user choice on the second selection box , The third selection populates the box.

My Ajax:

  $ (document) .ready (function () {$ ("# squery"). Change (function (e) {SelectText = $ ( ("#squery"). val (); PassData = $ ("# PDATA"). html (); if (selectiontext == "") {$ ("# teammailer"). SlideUp ();} and {$ ("#mail mailer"). Load ("mailerAjax.php", {SelectInput: SelectText, PermissionData: PassData}); $ ("# teamMailer"). SlideDown ();}}); / ** Do not appear below Is the change (function (e) {part2text = $ ("# s_part2") .val (); passdata = $ ("# pdata"). Html ((". / / / Mailer.jax2.php", {SelectInput2 :}, "(" Status "=" error ") {var msg =" Sorry, but a The error was: "$$ (" #error ") .HTML (msg) + xhr.status +" "+ xhr.statusText);}}); $ (" # teamMailer2 "). SlideDown ();}}); });   

Some notes: The mailerax.ff file has the complete form selection function:

  SELECT id = "S_part2" option option option / selection   

The first Ajax output is perfect, but the second Ajax does not appear in the fire and there is no refund in it. Not a single error

My HTML:

  & lt; div class = "..." & gt; Choose recipients: & lt; / Div & gt; & Lt; div class = "..." & gt; & Lt; Select name = "target" tabandex = "1" expected id = "squery" & gt; & Lt; Option value = "" selected & gt; Choose ... & lt; / Options & gt; & Lt; Option value = "I" & gt; Individuals ... & lt; / Options & gt; & Lt; Option value = "t" & gt; One team ... & lt; / Options & gt; & Lt; Option value = "live" & gt; A group ... & lt; / Options & gt; & Lt; / Select & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; div class = "..." id = "teamMailer" & gt; & Lt; / Div & gt; & Lt; div class = "..." id = "teamMailer2" & gt; & Lt; / Div & gt; Therefore, 1) I like the clean and streamlined use of jQuery's .load function, but I need to use any other functions such as pst (I really want to avoid GET data transfers). )?  

3) I have this information

3) I know that base HTML can already be a basic solution of a SELECT box (unchanged) Though it looks beautifully with the complete selection box when it is populated and displayed only once

then whether the Ajax return from the second box returns to Ajax return to the third selection box The way?

M

1) .

3) Your problem is that you can not bind the element that does not exist. S_part2 I think your first request is loaded, so you need to force it at a higher level and event delegation handle it at the event bubble.

Therefore instead:

  $ ("# s_part2"). Try it (try: "Change", "# S_ part2") (Change the function (e) {...   

Try it:

   

This puts your handler on your (I think) parent div which exists and adds a filter so that it can only be executed when The original source id of the event matches S_part2 .

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -