0

I'm having problems in passing values ​​to the function using jquery when I select the two dates as below:

enter image description here

This takes the values ​​that are in the text as shown, but I would take the values ​​and pass to the function below

var dtLev = $("#dateLev option:selected").text() 

$.getJSON("/Grafic/GetDateByGraf", { selectedRodId: rodId, selectLevId: levId, selectDtLev: dtLev},

If I use .Val() the null value appears

How can I fix this

3
  • where you use .val() ? where the value null appears ? what are you trying to do ? Commented Feb 12, 2014 at 4:14
  • stackoverflow.com/questions/2543322/… check this link Commented Feb 12, 2014 at 6:16
  • I posted the answer the way you got thanks for the tip. Commented Feb 12, 2014 at 9:20

1 Answer 1

0

got this way,

var selectedOptions = $.map($('#dateLev :selected'),
function (e) { return $(e).val(); });
var dtLev = selectedOptions.join(',');
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.