Click here to Skip to main content
11,718,589 members (59,553 online)

Web Development

 
AnswerRe: This webpage has a redirect loop Pin
Kornfeld Eliyahu Peter5-Nov-13 0:03
professionalKornfeld Eliyahu Peter5-Nov-13 0:03 
GeneralRe: This webpage has a redirect loop Pin
Jassim Rahma5-Nov-13 0:09
memberJassim Rahma5-Nov-13 0:09 
AnswerRe: This webpage has a redirect loop Pin
Kornfeld Eliyahu Peter5-Nov-13 0:16
professionalKornfeld Eliyahu Peter5-Nov-13 0:16 
Questioncustom url include in php Pin
Jassim Rahma4-Nov-13 23:03
memberJassim Rahma4-Nov-13 23:03 
AnswerRe: custom url include in php Pin
thatraja5-Nov-13 2:24
mvpthatraja5-Nov-13 2:24 
QuestionGathering user computer information via web part/page Pin
BrentW824-Nov-13 6:15
memberBrentW824-Nov-13 6:15 
QuestionDisable Ajax Load On Wordpress Post Pin
Member 102891603-Nov-13 7:02
memberMember 102891603-Nov-13 7:02 
Questionhow to override the DC.title? Pin
Jassim Rahma3-Nov-13 0:22
memberJassim Rahma3-Nov-13 0:22 
Questionbest way to save and use date Pin
Jassim Rahma2-Nov-13 1:08
memberJassim Rahma2-Nov-13 1:08 
AnswerRe: best way to save and use date Pin
Richard MacCutchan2-Nov-13 6:02
mvpRichard MacCutchan2-Nov-13 6:02 
GeneralRe: best way to save and use date Pin
Jassim Rahma2-Nov-13 7:28
memberJassim Rahma2-Nov-13 7:28 
GeneralRe: best way to save and use date Pin
Richard MacCutchan2-Nov-13 7:40
mvpRichard MacCutchan2-Nov-13 7:40 
Questionwhy getting: argument for routine is not a variable?! Pin
Jassim Rahma1-Nov-13 23:29
memberJassim Rahma1-Nov-13 23:29 
QuestionMVC4 Ajax Call does not reach controller Pin
MYSHKSL1-Nov-13 10:43
memberMYSHKSL1-Nov-13 10:43 
I am new to MVC4. I am trying to issue ajax call on the button click to receive partial view with the loaded dropdown list. It looks like Ajax call never reaches controller's method GetMyList(). What is wrong with my code ?   Thank you


//in mypage.cshtml
@model IEnumerable<MyProject.Models.MyModel>
@{
      ViewBag.Title = "MyPage";
      Layout = "~/Views/Shared/_MyLayout.cshtml";
}

<div>
....

<div>
   <button id="btnGetList">Find</button>
</div>

<div id="divWithPartialView">
      @Html.Partial("_MyPartialView", Model)   // displayed on initial page load
</div>
...
</div>


@section MySection{

      <script type="text/javascript">

            $('#btnGetList').on('click', function (event) {

                  alert("go get list");   // shows up

                  var myName = "Jo";

                  $.ajax({
                        type: "POST",
                        url: "Main/GetMyList",
                        data: myName,
                        success: function (data) {
                              alert("list is here");   //does Not show up
                              $("#divWithPartialView").html(data);
                        }

                  });

                  alert("after ajax");   //shows up

            })
      </script>
}

// Controller

namespace MyProject.Controllers
{
      public class MainController: Controller
      {

            ............

            [HttpGet]
            public ActionResult MyPage()
            {              
                  List<MyModel> myList = new List<MyModel>();
                  return View(myList);
            }

            public ActionResult GetMyList(string myName)
            {
                  MyModel mm = new MyModel();
                  List<MyModel> myList = mm.GetNames(myName); // using search criteria entered on the previous Application page
                 
                  return PartialView("_MyPartialView", myList);

            }
      }
}


//Partial View: _MyPartialView.cshtml
@model IEnumerable<MyProject.Models.MyModel>

<label>Select your name:</label>
<select id="lstNames">
      <option value="0">- select name -</option>
      @foreach (var name in Model)
      {
            <option value="@name.id">@name.myName</option>
      }
</select>


//Model
public class MyModel
{
      public int id { get; private set; }  
      public string myName { get; set; }  

      public List<MyModel> GetNames(string myName)
      {
            List<MyModel> myList = new List<MyModel>();
            //code to find names that start with "Jo"
            return myList;
      }
}
SuggestionRe: MVC4 Ajax Call does not reach controller Pin
Richard Deeming1-Nov-13 10:51
professionalRichard Deeming1-Nov-13 10:51 
Questionhow to header("Expires") in php Pin
Jassim Rahma1-Nov-13 8:42
memberJassim Rahma1-Nov-13 8:42 
QuestionUndefined index for $_SESSION variable Pin
Jassim Rahma1-Nov-13 8:33
memberJassim Rahma1-Nov-13 8:33 
AnswerRe: Undefined index for $_SESSION variable Pin
Peter Leow4-Nov-13 1:31
professionalPeter Leow4-Nov-13 1:31 
QuestionHow to rebind more three RadGrid after close the RadWindow Pin
Rahul_Pandit1-Nov-13 2:09
memberRahul_Pandit1-Nov-13 2:09 
SuggestionRe: How to rebind more three RadGrid after close the RadWindow Pin
Richard Deeming1-Nov-13 3:07
professionalRichard Deeming1-Nov-13 3:07 
QuestionHow to create a online service conversion of a file type to another type Pin
Moneyzz Sharma31-Oct-13 20:13
memberMoneyzz Sharma31-Oct-13 20:13 
AnswerRe: How to create a online service conversion of a file type to another type Pin
Richard MacCutchan31-Oct-13 23:52
mvpRichard MacCutchan31-Oct-13 23:52 
GeneralRe: How to create a online service conversion of a file type to another type Pin
Moneyzz Sharma2-Nov-13 0:35
memberMoneyzz Sharma2-Nov-13 0:35 
SuggestionRe: How to create a online service conversion of a file type to another type Pin
Richard MacCutchan2-Nov-13 0:41
mvpRichard MacCutchan2-Nov-13 0:41 
QuestionGet panel values Pin
vkEmerson31-Oct-13 3:45
membervkEmerson31-Oct-13 3:45 
Questionis the $_GET exists? Pin
Jassim Rahma30-Oct-13 1:13
memberJassim Rahma30-Oct-13 1:13 
AnswerRe: is the $_GET exists? Pin
Richard MacCutchan30-Oct-13 2:10
mvpRichard MacCutchan30-Oct-13 2:10 
AnswerRe: is the $_GET exists? Pin
Peter Leow4-Nov-13 1:35
professionalPeter Leow4-Nov-13 1:35 
AnswerRe: is the $_GET exists? Pin
Killzone DeathMan9-Jan-14 1:08
groupKillzone DeathMan9-Jan-14 1:08 
QuestionSVG in IE8 Pin
ThetaClear29-Oct-13 11:12
memberThetaClear29-Oct-13 11:12 
AnswerRe: SVG in IE8 Pin
RedDk29-Oct-13 12:06
memberRedDk29-Oct-13 12:06 
GeneralRe: SVG in IE8 Pin
ThetaClear29-Oct-13 21:47
memberThetaClear29-Oct-13 21:47 
AnswerRe: SVG in IE8 Pin
Paulo Augusto Künzel4-Nov-13 3:43
professionalPaulo Augusto Künzel4-Nov-13 3:43 
GeneralRe: SVG in IE8 Pin
ThetaClear5-Nov-13 10:08
memberThetaClear5-Nov-13 10:08 
GeneralRe: SVG in IE8 Pin
Paulo Augusto Künzel5-Nov-13 11:47
professionalPaulo Augusto Künzel5-Nov-13 11:47 
Question(HTML5 + Javascript + javascript Libs) or Razor Engine Pin
OmniSource28-Oct-13 22:48
memberOmniSource28-Oct-13 22:48 
Questionhow to password reminder Pin
Jassim Rahma28-Oct-13 11:00
memberJassim Rahma28-Oct-13 11:00 
AnswerRe: how to password reminder Pin
Richard Deeming28-Oct-13 12:33
professionalRichard Deeming28-Oct-13 12:33 
QuestionASP Net WebAPI Newby Question Pin
Kevin Marois28-Oct-13 6:14
memberKevin Marois28-Oct-13 6:14 
Questionget $_GET["id"] in window.location in PHP Pin
Jassim Rahma27-Oct-13 23:49
memberJassim Rahma27-Oct-13 23:49 
SuggestionRe: get $_GET["id"] in window.location in PHP Pin
Richard MacCutchan28-Oct-13 2:09
mvpRichard MacCutchan28-Oct-13 2:09 
AnswerRe: get $_GET["id"] in window.location in PHP Pin
Killzone DeathMan9-Jan-14 1:11
groupKillzone DeathMan9-Jan-14 1:11 
Questionwhy getting Strict Standards: Only variables should be passed by reference? Pin
Jassim Rahma27-Oct-13 23:20
memberJassim Rahma27-Oct-13 23:20 
Questionexpire login's session Pin
Jassim Rahma27-Oct-13 0:06
memberJassim Rahma27-Oct-13 0:06 
QuestionRe: expire login's session Pin
Richard MacCutchan27-Oct-13 2:07
mvpRichard MacCutchan27-Oct-13 2:07 
SuggestionRe: expire login's session Pin
thatraja28-Oct-13 1:02
mvpthatraja28-Oct-13 1:02 
Questionprofile address url validation Pin
Jassim Rahma26-Oct-13 11:05
memberJassim Rahma26-Oct-13 11:05 
AnswerRe: profile address url validation Pin
ProgramFOX26-Oct-13 23:43
member ProgramFOX26-Oct-13 23:43 
GeneralRe: profile address url validation Pin
Jassim Rahma26-Oct-13 23:56
memberJassim Rahma26-Oct-13 23:56 
AnswerRe: profile address url validation Pin
ProgramFOX27-Oct-13 5:39
member ProgramFOX27-Oct-13 5:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.150901.1 | Last Updated 3 Sep 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid