Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7979827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:52:57+00:00 2026-06-04T09:52:57+00:00

i have a script in my view which is: $(‘.datepicker’).datepicker ( { onSelect: function

  • 0

i have a script in my view which is:

$('.datepicker').datepicker
(
{ onSelect: function (dateText, inst) {
    //pass dateText to my controller

});
 </script>

my controller is like this:

    public ActionResult Index()
    {
        string dateSelected = dateText; //read dateText here
        if (DateTime.TryParse(dateSelected, out date))
        {
            date = Convert.ToDateTime(dateSelected);
            var reservations = db.Reservations.Where(r => r.Date == date).Include(r => r.Employee).Include(r => r.Room).OrderByDescending(r => r.Date);

            return View(reservations);
        }
        return View();

    }

i want dateText to be passed to the controller without the current page being refreshed or reloaded. how to do that?

i tried forms earlier and on the onselect event of the datepicker, i automatically submit the form so the controller can accept it. but i do not want the current page to be refreshed or reloaded.

i just want to pass dateText to the controller without the user noticing the passing.. some sort of $.post i guess but i dont know how to implement it..

UPDATE: here is my try, what is wrong:

ok here is my script:

     JSONstring = JSON.stringify(dateText);
    $.post("/Home/Index", { jsonData: JSONstring });

here is my controller:

     public ActionResult Index(string jsonData)
    {
        CacheClear();
        string dateSelected = jsonData;
         .....
        //i tried to debug it, but no value of jsonData

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:52:58+00:00Added an answer on June 4, 2026 at 9:52 am

    use ajax and send all the variables or data in the ajax data string and provide the url of your controller for example

        function add_to_cart(id , title, price,qty){
    
        $.ajax({
            type: "POST", 
       url: "your controller" + id ,
      data: "&title=" + title + "&price=" + price +"&quantity=" + qty ,
            complete: function(data) {
                //alert("Item added to cart");
    
            }
        });
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this script which is used to append: function append_place(type) { var shop_type
I have script like this : fullscript.sh if [ ! -f /opt/laks/linux-2.6.33.2.tar.bz2 ] then
I have this script which fires scrolling to next/prev when N and P keys
I have this script that displays all the users images which i will display
I have a View in which I'm using a tooltip provided by this site:
I have put together a script which is very much like the flickr photostream
So I have a script which creates a simple table view, but changing a
I have a php script which generates an image, and is used (mainly) like
I have the following controller which contains a view: Lead.Controllers.UrlSearch = Ember.Object.extend init: ->
in asp-mvc, i have a partial view which contains this: <table id=grid> </table> <div

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.