ItIntern3's Profile User Rating: -----

Reputation: 6 Worker
Group:
Active Members
Active Posts:
97 (0.05 per day)
Joined:
14-July 10
Profile Views:
10,353
Last Active:
User is offline Dec 24 2013 10:57 AM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
XBox
Your Car:
Honda
Dream Kudos:
0
Icon   ItIntern3 is coding in .NET

Posts I've Made

  1. In Topic: Simple $(document).ready() Not Working

    Posted 22 Dec 2013

    From what I have read if jquery functions mysteriously do not work even though the syntax is correct according to the documentation on http://jquery.com/ there are conflicting library imports on occurring on the same page, essentially overwriting the constructed javascript object each jquery library creates.
  2. In Topic: Simple $(document).ready() Not Working

    Posted 19 Dec 2013

    Thanks for your suggestion. I was able to locate a faulty input mask jquery function (which was working with the 1.6.1 version).
  3. In Topic: Posting Javascript Array to Controller via AJAX

    Posted 19 Aug 2013

    I apologize for the delay but I found out this issue was due to the type of button I was using...

    Originally I had:
    <input type ="submit" value = "Button Text" />          
    
    


    When I changed to:
    <input type ="button" value = "Button Text" />          
    
    


    The AJAX posted my array to my controller using this code:

                       var highlightedCells = new Array();
                       $.ajax({
                            type: 'POST',
                            url: '/Controller/View',
                            traditional: true,
                            dataType: "json",
                            data: { methodParam: highlightedCells },
                            success: function (data) {
                                alert("success");
                            },
                            error: function (args) {
                                alert("Error on ajax post");
                            }
                        })
    
    


    My controller signature is as follows:
     [HttpPost]
            public ActionResult TutorAvailability(string[] methodParam)
            {...}
    
    
  4. In Topic: Posting Javascript Array to Controller via AJAX

    Posted 15 Aug 2013

    After looking in the google chrome debugger, I found that my page is being posted to my action method twice. Once with the actual data that I want, and a second time when the data I am passing to the controller is null (as it should be because the user did not enter data and then click the submit button). Is this because the action method methodName returns the view with the model in it after the ajax method posts, so the communication looks like this:

    1. user enters input from page
    2. ajax method posts to controller (with the gathered data from the user)
    3. controller calls view
    4. view calls controller?
    5. controller returns the view with the model
    6. the on error method is called within my ajax function displaying an error message.

    I do not know why the fourth step is occurring (which in effect causes the 5th and 6th steps), it seems as through the page is posting to the controller even through the user does not hit the "submit" button. I also do not understand why my error javascript function is being invoked if in fact the data was successfully submitted back to the controller in step 2 (although this success is never relayed back to the user). It is important to note that only when I place a break point within my javascript code in my browser can I see this activity (of 2 posts), if I just have a break point on the controller action method return statement, I see only the second post (when the variable I am passing back in the ajax method is null).

    any help would be much appreciated.

My Information

Member Title:
D.I.C Head
Age:
23 years old
Birthday:
April 27, 1992
Gender:
Location:
Reading, PA, USA
Interests:
Computer architecture, Programming, .NET and Java Eclipse Development
Full Name:
Mark
Years Programming:
3
Programming Languages:
C#, C++, VB, Java, Pascal, BASIC, SQL

Contact Information

E-mail:
Click here to e-mail me

Friends

Comments

Page 1 of 1
  1. Photo

    D.Mulroy Icon

    17 Sep 2010 - 05:01
    Repping PA ^_^, I live in York heading of to Mansfield Uni for CS Fall 2011
Page 1 of 1