RSS Git Download  Clone
Raw Blame History
<!-- BEGIN [% component.name %] -->
    <script type="text/javascript">
        // nhs number ajax validation:
        $('#nhs_number').blur(function() { // alert("Handler for .blur() called.");
            var formData = { 'nhs_number' : $('input[name=nhs_number]').val() };
            var appMethod = "[% uri_for_nhs_number_validation %]";
            $.ajax({
                url: appMethod,
                data: formData,
                type: 'post',
                dataType: 'json',
                // the response is passed to the function
                success: function( json ) { // alert(json.result);
                    $( "#nhsno_result" ).text(json.result); 
                },
            });
            // this also works as a simple 'get' request:
            // $.get( appMethod, formData )
            // .done( function(data) { $( "#nhsno_result" ).text(data) } );
        });
    </script>
<!-- END [% component.name %] -->