if the .load isn't fired, then it's possible that the first one $.post($(this).attr('action'), $(this).serialize() ......
, isn't fired either ? did you debug it adding a console.log() or an alert() ? Can you confirm that this $.post is fired and returns something ? On Tuesday, February 19, 2013 5:59:07 PM UTC+1, AnnG wrote: > > Thanks. Sorry about the delay in response. > In answer to your question, the .load function does not get called, that > is, the body of the function(response) does not appear to get called. I > tried just the line: > $('#scan_info_previous').hide; and the div element with that ID does not > become hidden. > The 'action' is called OK though, and the db update in that action > ('add_new_scan') does take place. > > In answer to your point about using the nice web2py facilities, I feel > that I had to avoid these in places, as I have a recursive function to > generate a dynamic form which has divs within divs (so that I can have > collapsing/expanding form elements depending on the value of their parent > input elements). > If you can show me a way to use the web2py facilities, I would prefer this. > > Regards, Ann > > > > On Thu, Feb 14, 2013 at 3:22 PM, Niphlod <nip...@gmail.com > <javascript:>>wrote: > >> easier to read, still impossible to reproduce. You're doing everything >> without using the nice facilities web2py provides, but since you're going >> that way, let's try to break up and analyze the issue. >> You're attaching a submit handler and discarding completely the response >> >> $.post($(this).attr('action'), $(this).serialize(), function(response){ >> ************ THIS PART NOT WORKING - START ************** >> $('#scan_info_previous').load( >> "{{=URL('get_patient_scan_info')}}", document.getElementById( >> "hidden_patient_id").value); >> OR I've also tried... >> ajax('{{=URL('get_patient_scan_info')}}',['hidden_patient_id'], ' >> scan_info_previous'); >> ************ THIS PART NOT WORKING - END ************** >> },'json'); >> >> what you're sending to the action url is the inputs serialized as >> json..... and until here, there should be no issues. >> When the action url returns something, scan_info_previous should be >> filled with the contents coming from what url ? Here it seems that it's the >> get_patient_scan_info ..... but you seem to want to pass along the >> "hidden_patient_id" parameter with that, and $(element).load() is a jquery >> function that doesn't work the same as the ajax() one that is coded within >> web2py. We don't know how your "get_patient_scan_info" works to give you >> the details on how to pass something to that. Have you at least checked >> that the request to get_patient_scan_info is being fired (i.e. you have >> problems firing the actual request or managing it at web2py's level)? >> >> >> On Thursday, February 14, 2013 3:26:05 PM UTC+1, AnnG wrote: >>> >>> Sorry, I've now attached the code as a file. >>> I corrected that error, thanks. ....Still doesn't work. >>> >>> >>> On Thursday, February 14, 2013 1:01:46 PM UTC, Niphlod wrote: >>>> >>>> meh, next time include the code as an attachment or use the google >>>> group interface that can format code inline...far more readable! >>>> Anyway, I'm at work and can't test it (nor anyone, without models, >>>> controllers, and so on), but I spotted an error >>>> >>>> $('scan_info_previous').load(" >>>> {{=URL('get_patient_scan_info'**)}}", >>>> document.getElementById("**hidden_patient_id").value); >>>> >>>> if you refer to something like <div id="scan_info_previous"></div> the >>>> jquery selector is >>>> $('#scan_info_previous') not $('scan_info_previous') >>>> >>>> >>>> -- >> >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+un...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.