-1

this is my script in JQUERY step

   onStepChanged: function (event, currentIndex, priorIndex) {
        if (currentIndex === 3) {
       
            $.ajax({
                url: '/UserPanel/Home/GetAddressDetailsFromSession',
                type: 'GET',
                success: function (addressDetailsResponse) {
                    console.log('Address Details Received:', addressDetailsResponse.addressDetails);

                    if (addressDetailsResponse.success) {
                     
                        $('#reviewAddress').val(addressDetailsResponse.addressDetails.address);
                        $('#reviewState').val(addressDetailsResponse.addressDetails.state);
                        $('#reviewDistrict').val(addressDetailsResponse.addressDetails.district);
                        $('#reviewZipCode').val(addressDetailsResponse.addressDetails.zipCode);
                    } else {
                        console.error('error: ', addressDetailsResponse.message);
  alert(addressDetailsResponse.message);
 }
                },

            });
        }
    }
});

and this is my view to update the view:

     <h4>Your Address</h4>
 <section>
     <div class="row mb-3">
         <div class="col-lg-12">
             <div class="input-group mb-3">
                 <div class="input-group-prepend">
                     <span class="input-group-text">Address</span>
                 </div>
                 <input id="reviewAddress" type="text" class="form-control" disabled>
             </div>
         </div>
     </div>
     <div class="row">
         <div class="col-md-5 mb-3">
             <label>State</label>
             <input id="reviewState" type="text" class="form-control" disabled>
         </div>
         <div class="col-md-5 mb-3">
             <label>District</label>
             <input id="reviewDistrict" type="text" class="form-control" disabled>
         </div>
         <div class="col-md-2 mb-3">
             <label>Zip Code</label>
             <input id="reviewZipCode" type="text" class="form-control" disabled>
         </div>
     </div>
 </section>

even I Get correct data in console , the UI does not update I get correct data from controller in debug but in the view it does not update

5
  • https://localhost:44371/YourController/GetAddNewAddressForm - It specifically says "YourController"? Not "HomeController" as implied by this?: Url.Action("GetAddNewAddressForm", "Home") Are you specifically indicating that the data-url attribute on your <button> is somehow changing? The snippets of code shown are somewhat disconnected from each other, it's not really clear what specifically is happening and it seems there is debugging information missing. Can you use your browser's debugging tools to more closely debug the functionality and see where the problem first occurs?
    – David
    Commented Jun 26 at 12:31
  • @David It was for other option I fix it, but after submit form, it does not work again and form does not reload again, it means button work just one time , after submitting does not work, I update script for submiting Commented Jun 26 at 13:07
  • What "other option"? What did you fix and how does that change the question being asked above? Which specific operation in the code shown is producing the error in the question? You're showing two AJAX operations, which one is failing? Both of them get their URL from the markup on the page. When you debug your client-side code in your browser's debugging tools, what exact URL is being fetched from that markup and in what way does it differ from what you expect? Please do some debugging and be specific about the problem you are observing and asking about.
    – David
    Commented Jun 26 at 13:11
  • @David I want to bind the form for new event for dynamic element. when click on add new address, it works but for second event it doesnot Commented Jun 26 at 16:08
  • You're talking about multiple problems. In the question you're asking about an HTTP 404 error, in the comments you're trying to ask about binding an event to an element. Pick one problem that you're trying to solve and update the question to specifically address that one problem. If you move on to a different problem with every comment then nobody will be able to help you.
    – David
    Commented Jun 26 at 16:16

0

Browse other questions tagged or ask your own question.