[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


jquery ajax plugin  multiple options

Posted on 2012-08-31
Medium Priority
Last Modified: 2012-09-01
The following plugin fails, however, succeeds when I change the data to only the PeId name value pair.
How do I code multiplename-value paris involving options?
An example of two or even three name value pairs in the data would be helpful

Here is the code

$.fn.qbeexecSearch = function (options) {

      var defaults = {
             url: 'TSRIQBEF/jx/jxdefault.asp',
             destination: '#targ',
             getparam:  "this=that"
       }; //default options
       var retval = "";
      //inherit from provided configuration (if any)
      var options = $.extend(defaults, options);
            case "search":
                        type: "POST",
                        url: options.url,
                        data: { 'PeId' : options.strPeId ; 'PeName' : options.strPeName},
                        success: function(data,extStatus,jqXHR){

                        complete:  function(){
                        var pagecount = Number($('#SearchResults').attr("reccount")) / 10
                        alert("line 40 " + pagecount);
                        $('#recordcountliteral').html("Record 1 of " + $('#SearchResults').attr("reccount"));
                        error: function(request,status,error){
                              alert("An error has occurred.  Ref: qbe_plugin.js Line 40.  Error: " = request.responseText);                                                
Question by:KeithMcElroy
1 Comment
LVL 60

Accepted Solution

Julian Hansen earned 2000 total points
ID: 38357051
Separate with commas not semi-colons and your key values don't need quotes so

  data: { PeId : options.strPeId,  PeName : options.strPeName},

Open in new window

Try that

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

DOM Attributes and Properties treatment with jQuery 1.6 by Ivo Stoykov jQuery (http://jquery.com/) 1.6 introduces .prop() (http://api.jquery.com/prop/) and .removeProp() (http://api.jquery.com/removeProp/) methods which allow modifying or removi…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question