jQuery Plugins » file https://jqueryplugins.info jQuery plugins, tutorials and resources Wed, 19 Oct 2011 07:14:18 +0000 en hourly 1 http://wordpress.org/?v=3.2.1 jQuery.ajax type: Post to an ashx file not being initiated in IE. works fine in FF, Chrome, and Safari https://jqueryplugins.info/2011/10/jquery-ajax-type-post-to-an-ashx-file-not-being-initiated-in-ie-works-fine-in-ff-chrome-and-safari/ https://jqueryplugins.info/2011/10/jquery-ajax-type-post-to-an-ashx-file-not-being-initiated-in-ie-works-fine-in-ff-chrome-and-safari/#comments Thu, 13 Oct 2011 04:17:06 +0000 Admin https://jqueryplugins.info/2011/10/jquery-ajax-type-post-to-an-ashx-file-not-being-initiated-in-ie-works-fine-in-ff-chrome-and-safari/ Post link: jQuery.ajax type: Post to an ashx file not being initiated in IE. works fine in FF, Chrome, and Safari

this is my first question to the stack. jQuery.ajax type: Post to an ashx file not being initiated in IE. works fine in FF, Chrome, and Safari Code below: $...

]]>
Post link: jQuery.ajax type: Post to an ashx file not being initiated in IE. works fine in FF, Chrome, and Safari

this is my first question to the stack.

jQuery.ajax type: Post to an ashx file not being initiated in IE. works fine in FF, Chrome, and Safari

Code below:

$  .ajax({
    type: "Post",
        url: "[ ... ]loguserdata.ashx?" + dataString,
        data: "",
        cache: "false",
        contentType: "text/plain",
        success: function(msg){
            //alert( "Data Saved: " + msg );
        }
});

by works fine in FF, etc. I mean the ashx file is called and info is logged.
I can see the ajax call in fiddler, firebug and chrome’s equivalent.

but there doesn’t seem to be jackchit happening in IE9 or in IE compatibility mode.

I can get several versions of the code above to work in the other browsers. Including a $ (‘#result’).load( …

but NOTHING works in IE

btw, works fine locally in IE.

oh, and I don’t give a diddly poo about any return value.

and it’s not a cache issue. I have a date=getTime() tacked onto the end of the querystring.

querystring (dataString) looks something like fname=john&lname=doedy

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/jquery-ajax-type-post-to-an-ashx-file-not-being-initiated-in-ie-works-fine-in-ff-chrome-and-safari/feed/ 0
Stop input type file from opening ‘open window’ https://jqueryplugins.info/2011/10/stop-input-type-file-from-opening-open-window/ https://jqueryplugins.info/2011/10/stop-input-type-file-from-opening-open-window/#comments Tue, 11 Oct 2011 04:21:51 +0000 Admin https://jqueryplugins.info/2011/10/stop-input-type-file-from-opening-open-window/ Post link: Stop input type file from opening ‘open window’

How can I stop input type=file from opening ‘open window’ without disabling it? Any method I can try using jquery or javascript? newest questions tagged jquery – Stack Overflow

]]>
Post link: Stop input type file from opening ‘open window’

How can I stop input type=file from opening ‘open window’ without disabling it? Any method I can try using jquery or javascript?

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/stop-input-type-file-from-opening-open-window/feed/ 0
HTML5 / JS – Display multiple file input in div https://jqueryplugins.info/2011/10/html5-js-display-multiple-file-input-in-div/ https://jqueryplugins.info/2011/10/html5-js-display-multiple-file-input-in-div/#comments Mon, 10 Oct 2011 22:15:11 +0000 Admin https://jqueryplugins.info/2011/10/html5-js-display-multiple-file-input-in-div/ Post link: HTML5 / JS – Display multiple file input in div

I am using HTML5′s wonderful ‘multiple’ file select feature. <input type="file" id="fileInput" onChange="runTest()" multiple> I would like to display the selected filenames below the input field and make it look...

]]>
Post link: HTML5 / JS – Display multiple file input in div

I am using HTML5′s wonderful ‘multiple’ file select feature.

<input type="file" id="fileInput" onChange="runTest()" multiple>

I would like to display the selected filenames below the input field and make it look pretty with CSS, however…

If I run a test JS function, that ‘alerts’ me of the input field’s value, it only shows one file regardless of me selecting 10.

function runTest() {
var fileInput = document.getElementById('fileInput').value;
alert("You selected: "+fileInput);
}

I was doing this for when I had a ‘single’ file input field and worked okay but now it’s ‘multiple’, it doesn’t like it.

Any suggestions?

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/html5-js-display-multiple-file-input-in-div/feed/ 0
How to put a jQuery code into one file which will be referenced by all pages? https://jqueryplugins.info/2011/10/how-to-put-a-jquery-code-into-one-file-which-will-be-referenced-by-all-pages/ https://jqueryplugins.info/2011/10/how-to-put-a-jquery-code-into-one-file-which-will-be-referenced-by-all-pages/#comments Thu, 06 Oct 2011 18:20:59 +0000 Admin https://jqueryplugins.info/2011/10/how-to-put-a-jquery-code-into-one-file-which-will-be-referenced-by-all-pages/ Post link: How to put a jQuery code into one file which will be referenced by all pages?

I have a login popup that will pop up on every page of my site. What I want to do is once the user clicks submit, to have a single...

]]>
Post link: How to put a jQuery code into one file which will be referenced by all pages?

I have a login popup that will pop up on every page of my site. What I want to do is once the user clicks submit, to have a single JS file where the jQuery code for handling that request lives, and makes an AJAX call to validate the parameters in the DB.

I am able to get the pop up box to pop up. And the form loads. I am thinking my jQuery code will live in a separate imported file and look like this:

<script type="text/javascript" >
$  (function()
{
    $  ("input[type=submit]").click(function()
    {
        var some_params= $  ("#param").val();

        var dataString = 'Some url to send to ajax';

        if( params validated ok )
        {
            $  ('.success').fadeOut(200).hide();
            $  ('.error').fadeOut(200).show();
        }
        else
        {
            $  .ajax({
                type: "POST",
                url: "/problems/add_problem.php",
                dataType: "json",
                data: dataString,
                success: function(json)
                {
                    $  ('.success').fadeIn(200).show();
                    $  ('.error').fadeOut(200).hide();
                }
            });
        }

        return false;
    });
});
</script>

So my question is how do I make this get invoked only when the right form is submitted? The form would have some id=”some_name” but I don’t really understand how to make this jQuery code get executed only when that form element is called.

Any ideas?

Thanks!!

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/how-to-put-a-jquery-code-into-one-file-which-will-be-referenced-by-all-pages/feed/ 0
Populate a JSON file with Rails fields in Profile.all https://jqueryplugins.info/2011/09/populate-a-json-file-with-rails-fields-in-profile-all/ https://jqueryplugins.info/2011/09/populate-a-json-file-with-rails-fields-in-profile-all/#comments Thu, 29 Sep 2011 04:19:34 +0000 Admin https://jqueryplugins.info/2011/09/populate-a-json-file-with-rails-fields-in-profile-all/ Post link: Populate a JSON file with Rails fields in Profile.all

I’m using jQuery Tokeninput for tags in my Rails app. I have never dealt with JSON before (I’m new to programming) but I was wondering if there was a way...

]]>
Post link: Populate a JSON file with Rails fields in Profile.all

I’m using jQuery Tokeninput for tags in my Rails app. I have never dealt with JSON before (I’m new to programming) but I was wondering if there was a way to create then populate a json file with string values from Profile.all.

Here is the index in my TagsController:

class TagsController < ApplicationController
  def index
    @tags = Tag.where("name like ?", "%#{params[:q]}%")
    respond_to do |format|
      format.html
      format.json { render :json => @tags.map(&:attributes) }
    end
  end
end

If it is possible, can someone give me an idea of how it might be done? If more code is needed let me know!

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/09/populate-a-json-file-with-rails-fields-in-profile-all/feed/ 0
How to save binary file on client in jquery .post https://jqueryplugins.info/2011/09/how-to-save-binary-file-on-client-in-jquery-post/ https://jqueryplugins.info/2011/09/how-to-save-binary-file-on-client-in-jquery-post/#comments Wed, 28 Sep 2011 17:15:08 +0000 Admin https://jqueryplugins.info/2011/09/how-to-save-binary-file-on-client-in-jquery-post/ Post link: How to save binary file on client in jquery .post

I have handler with this code: HttpRequest request = context.Request; HttpResponse response = context.Response; if (request["Type"] != null) { try { string resultFile = null; string fileName = string.Empty; int...

]]>
Post link: How to save binary file on client in jquery .post

I have handler with this code:

    HttpRequest request = context.Request;
    HttpResponse response = context.Response;

    if (request["Type"] != null)
    {
        try
        {
            string resultFile = null;
            string fileName = string.Empty;

            int type = Convert.ToInt32(request["Type"]);

            switch (type)
            {
                case 1:
                    fileName = "InnerQuery.doc";
                    resultFile = GenerateInnerQuery(Id);
                    break;

                case 2:
                    fileName = "CourierQuery.doc";
                    resultFile = GenerateCourierQuery(Id);
                    break;

                case 3:
                    fileName = "TransportDogovor.doc";
                    resultFile = GenerateTransportDogovor(Id);
                    break;

                case 4:
                    fileName = "TransportQuery.doc";
                    resultFile = GenerateTransportQuery(Id);
                    break;

                case 5:
                    fileName = "PassQuery.doc";
                    resultFile = GeneratePassQuery(Id);
                    break;
            }

            if (resultFile != null)
            {
                response.Clear();
                response.AddHeader("pragma", "no-cache");
                response.AddHeader("cache-control", "private");
                response.CacheControl = "no-cache";
                response.ContentType = "application/octet-stream";
                response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}",
                    System.Web.HttpUtility.UrlPathEncode(fileName)));
                response.OutputStream.Write(File.ReadAllBytes(resultFile), 0, (int)(new FileInfo(resultFile)).Length);
                response.End();
            }
        }
        catch (Exception ex)
        { }
    }

On client i post data to handler with jQuery.post():

var handler = "GetWord.ashx?Type=6";
    var initiationDateFrom = $  ("#<%=InitiationDateFromTxt.ClientID%>").val();
    var initiationDateTill = $  ("#<%=InitiationDateTillTxt.ClientID%>").val();
    var queryDateFrom = $  ("#<%=QueryDateFromTxt.ClientID%>").val();
    var queryDateTill = $  ("#<%=QueryDateTillTxt.ClientID%>").val();
    var queryNumber = $  ("#<%=NumberTxt.ClientID%>").val();
    var initiator = $  ("#<%=InitiatorTxt.ClientID%>").val();
    var state = $  ("#<%=StateList.ClientID%>").val();
    $  .post(handler,
    {
        InitiationDateFrom: initiationDateFrom,
        InitiationDateTill: initiationDateTill,
        QueryDateFrom: queryDateFrom,
        QueryDateTill: queryDateTill,
        QueryNumber: queryNumber,
        Initiator: initiator,
        State: state
    }, function (data) {
       /*here i should save my file*/
    });

I recieve binary word-file in “data”, but can’t to save it on client.

last time i use:

window.location = handler;

but with jQuery.post it not work.

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/09/how-to-save-binary-file-on-client-in-jquery-post/feed/ 0
MVC3 – File upload controller / handler not receiving the image https://jqueryplugins.info/2011/09/mvc3-file-upload-controller-handler-not-receiving-the-image/ https://jqueryplugins.info/2011/09/mvc3-file-upload-controller-handler-not-receiving-the-image/#comments Wed, 28 Sep 2011 02:14:41 +0000 Admin https://jqueryplugins.info/2011/09/mvc3-file-upload-controller-handler-not-receiving-the-image/ Post link: MVC3 – File upload controller / handler not receiving the image

I am using http://valums.com/ajax-upload/ File uploader plugin to do ajax image upload and i see the request in fiddler go through, with the image in it when i pick a...

]]>
Post link: MVC3 – File upload controller / handler not receiving the image

I am using http://valums.com/ajax-upload/
File uploader plugin to do ajax image upload and i see the request in fiddler go through, with the image in it when i pick a local image. The fiddler request has the PNG file in it.

From fiddler –

POST http://localhost:16169/client/account/uploadimage/202?qqfile=logo_l.png HTTP/1.1
Host: localhost:16169
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
X-Requested-With: XMLHttpRequest
X-File-Name: logo_l.png
Content-Type: application/octet-stream
Referer: http://localhost:16169/client/events/edit/202
Content-Length: 32660
Pragma: no-cache
Cache-Control: no-cache

�PNG

���
IHDR�����������¯�C���gAMA����
�a���   pHYs�����&�?���tEXtSoftware�Microsoft Office�5q��IDATx^��G�=���8,����@p
�ݓ�@�$  ��������.+��T���H���ϗ}��<��ܹsgg�O�����6111A���A2�@J�%�K!��K��)����ζ)�Mm��@�{�;ˤ�
ˤt�d���FK���og�Ц�6�a �=�eR�?�eR:m2�@J�%�F���m
hS@��0�����2)��2)�6b �ђa����6�)�MvHv�og���Oa��N�1��hɰ���l���&;$  ����L����LJ�M�Hi�d�h�v�Mm

I have truncated the request but you get the idea that the image is being transmitted in the post body.

But when i do

var image = WebImage.GetImageFromRequest();

in the controller that handles this post request. Image comes out to be null, Looking at the debugger all other values are present.

Request.Files.Count = 0

as well.

Anyone gone through this, or can help me debug this will be greatly appreciated. Thanks.

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/09/mvc3-file-upload-controller-handler-not-receiving-the-image/feed/ 0
How to make hidden div which appears when file is found? https://jqueryplugins.info/2011/09/how-to-make-hidden-div-which-appears-when-file-is-found/ https://jqueryplugins.info/2011/09/how-to-make-hidden-div-which-appears-when-file-is-found/#comments Mon, 26 Sep 2011 14:16:02 +0000 Admin https://jqueryplugins.info/2011/09/how-to-make-hidden-div-which-appears-when-file-is-found/ Post link: How to make hidden div which appears when file is found?

I was trying to make hidden div which shows on when .txt file is found. I want that div shows content of .txt file. Is that possible? I have tried...

]]>
Post link: How to make hidden div which appears when file is found?

I was trying to make hidden div which shows on when .txt file is found.
I want that div shows content of .txt file.

Is that possible?

I have tried to make it by using jQery but without success.

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/09/how-to-make-hidden-div-which-appears-when-file-is-found/feed/ 0
swfupload jquery plugin file upload list https://jqueryplugins.info/2011/09/swfupload-jquery-plugin-file-upload-list/ https://jqueryplugins.info/2011/09/swfupload-jquery-plugin-file-upload-list/#comments Mon, 26 Sep 2011 13:14:46 +0000 Admin https://jqueryplugins.info/2011/09/swfupload-jquery-plugin-file-upload-list/ Post link: swfupload jquery plugin file upload list

Was just wondering if anyone knows if you can set the limit of upload files to display on the list after selecting the files? (NOT the max amount of images...

]]>
Post link: swfupload jquery plugin file upload list

Was just wondering if anyone knows if you can set the limit of upload files to display on the list after selecting the files? (NOT the max amount of images you can upload)

eg. I choose to upload 10 images, normally it will display a list with all 10 images in the queue… instead i want it to display only 5 images and as each uploads and leaves the queue list at the bottom the next one shows up…

OR

another option is to display the overall upload progress instead of individual files… is this possible with this plugin?

Thanks in advance for any help!!

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/09/swfupload-jquery-plugin-file-upload-list/feed/ 0
jqgrid – upload a file in add/edit dialog https://jqueryplugins.info/2011/09/jqgrid-upload-a-file-in-addedit-dialog/ https://jqueryplugins.info/2011/09/jqgrid-upload-a-file-in-addedit-dialog/#comments Mon, 26 Sep 2011 03:15:16 +0000 Admin https://jqueryplugins.info/2011/09/jqgrid-upload-a-file-in-addedit-dialog/ Post link: jqgrid – upload a file in add/edit dialog

I’m new to jqgrid and I have learn many things through your answer. Now I have a problem: I want to upload files when adding or modifying records to a...

]]>
Post link: jqgrid – upload a file in add/edit dialog

I’m new to jqgrid and I have learn many things through your answer.

Now I have a problem: I want to upload files when adding or modifying records to a jqgrid?


This is my code:


{ name: 'File', index: 'file', hidden: true, enctype:"multipart/form-data", editable: true, edittype: 'file', editrules: { edithidden: true, required: true }, formoptions: { elmsuffix: ' *'} }


However the field I got in controller always be null :( . Any suggestion

Thanks in advance

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/09/jqgrid-upload-a-file-in-addedit-dialog/feed/ 0