0
<g:javascript>
 function yes(data){
 var id=$('#id').val(); 
 var pars = 'id=' + id+"&contact_preferences.email="+data;
 $.ajax({
        url: "${createLink(controller: 'userform', action: 'update')}",
        type: 'GET',
        data: pars,           
        success: function(data) {               
              alert("yupee");                
        }
    });
 }
</g:javascript>

i really dont know how to pass a value in ajax using type "GET"

2
  • Read the jQuery ajax documentation. Commented Jun 5, 2013 at 10:50
  • i know @JamesKleeh .. but the thing is when i use type GET.. it gives an error.. but when i use Post type its working fine...and the main thing is in grails passing values in different type.. so that controller know Commented Jun 5, 2013 at 10:55

1 Answer 1

1

See jQuery.ajax docs examples how to use data. In your case:

var pars = {id:id,contact_preferences.email:data};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.