I have some more detail on this issue.

Again, I'm trying to use jquery to grab the value generated by an an
ajax call (done in form 1) and then assign that ajax-generated value
to a field in another form (form2).

You can see the page and view the source here:
http://www.eastexhaust.com/inventory_.php

In this verion of the page, I'm using the "click" function and
attaching it to the form 1 submit button.

If I hard code the value I want placed in form2, like this...

<script type="text/javascript">
$(document).ready(function() {
  $("#partnumber").click(function(){
                $('#partnum').val ( 'this works' );
        });
 });
</script>

... jquery assigns it to the field correctly.

But if I code it to assign the ajax-generated value...

<script type="text/javascript">
$(document).ready(function() {
  $("#partnumber").click(function(){
                $('#partnum').val ( $('#myspan').text() );
        });
 });
</script>

...it does not work.

Could one of the problems be that the ajax-generated value is not
available when the jquery code fires? After all, the same submit
button is triggering both the ajax request and the jquery function.

Any sugeestions?

On Apr 12, 10:31 am, "webguy...@yahoo.com" <webguy...@yahoo.com>
wrote:
> Thanks! That did it!
>
> Can you take a look at where I ultimately need to go with this?
>
> This page...
>
> http://www.eastexhaust.com/inventory_.php
>
> ...has two forms.
>
> First one generates a part number via ajax.
>
> The next form sends us the part number with name, phone, email, etc.
>
> I'm trying to get the same part number that appears via ajax, to
> populate the value of the id="partnum" element in the second form.
>
> I can get it to work in FF by taking the ajax code:
>
>  if (http_request.status == 200) {
>             //alert(http_request.responseText);
>             result = http_request.responseText;
>             document.getElementById('myspan').innerHTML = result;
>
> ...and adding this:
>
>            document.getElementById('partnum').value= result;
>
> You can see that version here:
>
>            http://www.eastexhaust.com/inventory_1.php
>
> Unfortunately, that does not work in IE.
>
> Hence, I'm hoping jQuery can solve the problem.
>
> Or that someone can tell how to get the "non-jQuery version" that
> works in FF to work in IE.
>
> Thanks again for your help so far, and for any further help you can
> give me!
>
> On Apr 12, 9:52 am, victorg <vr.gerrit...@gmail.com> wrote:
>
> > <script language="text/javascript">   --> <script type="text/
> > javascript">
>
> > On Apr 12, 3:29 pm, webguy262 <webguy...@yahoo.com> wrote:
>
> > > I'm sorry for being so thick, but I'm stuck.
>
> > > Please, can someone view the source of this page...
>
> > >http://www.eastexhaust.com/jquerytest.html
>
> > > ...and tell me why it is not setting the value of the form element?
>
> > > ricardobeat wrote:
>
> > > > $('#myspan').text( $('#partnum').val() );
> > > >http://docs.jquery.com/Attributes
>
> > > > On Mar 29, 6:07 pm, webguy262 <webguy...@yahoo.com> wrote:
> > > >> I have two forms on a page (www.eastexhaust.com/inventory.php).
>
> > > >> One uses ajax to generate a part number by selecting values from a 
> > > >> series
> > > >> of
> > > >> selection boxes.
>
> > > >> The other form emails the part number so we can reply with a quote.
>
> > > >> Everything works fine in FFox, but does not work in IE.
>
> > > >> Therefore, I have had to make things harder by asking the user to copy
> > > >> and
> > > >> paste their part number into the email form instead of having it 
> > > >> entered
> > > >> there automatically.
>
> > > >> To display the part number to the user, I'm using this in the JS...
>
> > > >> document.getElementById('myspan').innerHTML = result;
>
> > > >> ...and this in the html...
>
> > > >> To get the variable in the email form, I'm using this in the JS...
>
> > > >> document.getElementById('partnum').value= result;
>
> > > >> ...and this in the html...
>
> > > >> <input type="text" name="partnum" id="partnum" readonly>
>
> > > >> As I said, this works everywhere but not in IE.
>
> > > >> How can I use Jquery to make it work across the board?
>
> > > >> Thanks!
> > > >> --
> > > >> View this message in
> > > >> context:http://www.nabble.com/ajax-problem-in-IE-tp22772776s27240p22772776.html
> > > >> Sent from the jQuery General Discussion mailing list archive at
> > > >> Nabble.com.
>
> > > --
> > > View this message in 
> > > context:http://www.nabble.com/ajax-problem-in-IE-tp22772776s27240p23011076.html
> > > Sent from the jQuery General Discussion mailing list archive at 
> > > Nabble.com.

Reply via email to