Click here to Skip to main content
15,882,017 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
i have already have a ajax jquery code to fetch the cust id in my code and that works fine but while i choose action i doesn't instead it fetch all action for the selected cust id

What I have tried:

This works fine

$.ajax({
               type: 'GET',
               url: '@Url.Action("GetReport", "Report")',
               dataType: 'json',
                data: { id: $("#ddl_Custid").val() },
               success: function (datas, status) {
                   var duplicate = [];

                   $("#ddl_Custid").append('<option value="-1">' + "-Select-" + '</option>');

                   $.each(datas, function (i, data) {
                       if (duplicate.indexOf(data.fld_cust_id) == -1) {
                           $("#ddl_Custid").append('<option value="' + data.fld_cust_id + '">' + data.fld_cust_id + '</option>');
                           duplicate.push(data.fld_cust_id);
                       }

                   });
               }

               });


But this Doesn't

$.ajax({
               type: 'GET',
               url: '@Url.Action("GetReport", "Report")',
               dataType: 'json',
                   data: { id: $("#ddl_Action").val() },
               success: function (datas, status) {
                   var duplicate = [];

                   $("#ddl_Action").append('<option value="-1">' + "-Select-" + '</option>');

                   $.each(datas, function (i, data) {
                       if (duplicate.indexOf(data.fld_action) == -1) {
                           $("#ddl_Action").append('<option value="' + data.fld_action + '">' + data.fld_action + '</option>');
                           duplicate.push(data.fld_action);
                       }

                   });
               }

           });

This the code part
responsedata = Elastic.Search<ProvLog>(s => s
                               .Index(defaultIndex)
                               .Size(8000)
                               .Query(q => q
                               .DateRange(r => r
                               .Field(p => p.fld_date)
                               .GreaterThanOrEquals(fromDate)
                               .LessThan(toDate)
                               .TimeZone("+05:30"))
                               && q.Match(m => m.Field(f => f.fld_cust_id).Query(fldCustid))
                               && q.Match(m => m.Field(f => f.fld_action).Query(fldAction))
                               )
                               .Sort(p => p.Descending("fld_date")));
                   data = (from hits in responsedata.Hits select hits.Source).ToList();
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900