Search Results

Search found 3437 results on 138 pages for 'append'.

Page 6/138 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Need advice on using Grails and Ajax to append to a div like in Rails

    - by Nate
    I'm just starting out in Grails and need some advice on using Ajax. I want to append some html to the bottom of a div inside a form. This is basically what I have: -form- -div id="listOfchildren"- childrow 1 input fields childrow 2 input fields childrow 3 input fields -/div- -form- -a-Add Child 4-/a- When I click on the "Add Child" I want to make an ajax call that results in a new childrow getting inserted into the "listOfchildren" div. So the document would look like this: -form- -div id="listOfchildren"- childrow 1 input fields childrow 2 input fields childrow 3 input fields childrow 4 input fields -/div- -form- -a-Add Child 5-/a- In Rails I would do something simple like this: render :update do |page| page.insert_html :bottom, "list_of_children", :partial = child_partial page.replace "add_link", :partial = 'add_link' end The previous code sends an javascript back to the browser with two commands. The first command tells the browser to append some html to the bottom of a div. The second command updates the "add link" counter. In grails I can only see how to replace an entire div (which would wipe out the user's existing input) and I don't see how I can call multiple functions from the ajax response. I can probably do this if I was to write some javascript functions in prototype or whatever, but I'd like to avoid that if there is a simpler way. Thanks! Nate

    Read the article

  • Append data to same text file using java

    - by Manu
    SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyyy_HHmmSS"); String strCurrDate = formatter.format(new java.util.Date()); String strfileNm = "Customer_" + strCurrDate + ".txt"; String strFileGenLoc = strFileLocation + "/" + strfileNm; String Query1="select '0'||to_char(sysdate,'YYYYMMDD')||'123456789' class_code from dual"; String Query2="select '0'||to_char(sysdate,'YYYYMMDD')||'123456789' class_code from dual"; try { Statement stmt = null; ResultSet rs = null; Statement stmt1 = null; ResultSet rs1 = null; stmt = conn.createStatement(); stmt1 = conn.createStatement(); rs = stmt.executeQuery(Query1); rs1 = stmt1.executeQuery(Query2); File f = new File(strFileGenLoc); OutputStream os = (OutputStream)new FileOutputStream(f,true); String encoding = "UTF8"; OutputStreamWriter osw = new OutputStreamWriter(os, encoding); BufferedWriter bw = new BufferedWriter(osw); while (rs.next() ) { bw.write(rs.getString(1)==null? "":rs.getString(1)); bw.write(" "); } bw.flush(); bw.close(); } catch (Exception e) { System.out.println( "Exception occured while getting resultset by the query"); e.printStackTrace(); } finally { try { if (conn != null) { System.out.println("Closing the connection" + conn); conn.close(); } } catch (SQLException e) { System.out.println( "Exception occured while closing the connection"); e.printStackTrace(); } } return objArrayListValue; } The above code is working fine. it writes the content of "rs" resultset data in text file Now what i want is ,i need to append the the content in "rs2" resultset to the "same text file"(ie . i need to append "rs2" content with "rs" content in the same text file)..

    Read the article

  • jquery append() method on empty XML element

    - by Anthony
    This could just be a syntax error, but I'm trying to create a Document object from scratch, starting with document.implementation.createDocument() and then using jquery's append() method to add the elements. But it's not appending: var myDoc = document.implementation.createDocument("", 'stuff', null); $("stuff",myDoc).attr("test","tested"); $("stuff",myDoc).append("<test>A</test>"); $("<test>B</test>").appendTo("stuff",soapEnv); var s = new XMLSerializer(); alert(s.serializeToString(soapEnv)); This should output: <stuff test="tested"> <test>A</test> <test>B</test> </stuff> But instead it outputs: <stuff test="tested" /> So the selector seems to be working, just not the method. My only guess is the method doesn't account for the fact that elements are empty (<stuff />) until they have children. But that's just a guess.

    Read the article

  • .NET, ASHX, "Server cannot append header after HTTP headers have been sent" after sending PDF Streem

    - by Inturbidus
    I visit my ASHX file, and it outputs a PDF perfectly. If I visit the very same ASHX with a different query string (I append DateTime.Now.Ticks to the end each visit), and I get this error: Server cannot append hader after HTTP headers have been sent. My code is below: copy.CloseStream = false; document.Close(); var r = context.Response; r.ExpiresAbsolute = DateTime.Now; r.BufferOutput = true; r.ContentType = "application/pdf"; r.AppendHeader("Content-Type", r.ContentType); r.AppendHeader("Content-disposition", "inline; filename=" + context.Server.UrlEncode(formType.File_Name)); r.BinaryWrite(copyStream.ToArray()); r.StatusCode = 200; r.End(); originalReader.Close(); copy.CloseStream = true; copy.Close(); There is no other place in this code that headers are sent. You are seeing the entire interaction with the Response object. I've tried to use r.Flush(); and r.End(); I've also tried not sending them if they are already there, but this causes other issues.

    Read the article

  • Append data to same text file

    - by Manu
    SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyyy_HHmmSS"); String strCurrDate = formatter.format(new java.util.Date()); String strfileNm = "Customer_" + strCurrDate + ".txt"; String strFileGenLoc = strFileLocation + "/" + strfileNm; String Query1="select '0'||to_char(sysdate,'YYYYMMDD')||'123456789' class_code from dual"; String Query2="select '0'||to_char(sysdate,'YYYYMMDD')||'123456789' class_code from dual"; try { Statement stmt = null; ResultSet rs = null; Statement stmt1 = null; ResultSet rs1 = null; stmt = conn.createStatement(); stmt1 = conn.createStatement(); rs = stmt.executeQuery(Query1); rs1 = stmt1.executeQuery(Query2); File f = new File(strFileGenLoc); OutputStream os = (OutputStream)new FileOutputStream(f,true); String encoding = "UTF8"; OutputStreamWriter osw = new OutputStreamWriter(os, encoding); BufferedWriter bw = new BufferedWriter(osw); while (rs.next() ) { bw.write(rs.getString(1)==null? "":rs.getString(1)); bw.write(" "); } bw.flush(); bw.close(); } catch (Exception e) { System.out.println( "Exception occured while getting resultset by the query"); e.printStackTrace(); } finally { try { if (conn != null) { System.out.println("Closing the connection" + conn); conn.close(); } } catch (SQLException e) { System.out.println( "Exception occured while closing the connection"); e.printStackTrace(); } } return objArrayListValue; } The above code is working fine. it writes the content of "rs" resultset data in text file Now what i want is ,i need to append the the content in "rs2" resultset to the "same text file"(ie . i need to append "rs2" content with "rs" content in the same text file)..

    Read the article

  • Append to the end of a Char array in C++

    - by Taylor Huston
    Is there a command that can append one array of char onto another? Something that would theoretically work like this: //array1 has already been set to "The dog jumps " //array2 has already been set to "over the log" append(array2,array1); cout << array1; //would output "The dog jumps over the log"; This is a pretty easy function to make I would think, I am just surprised there isn't a built in command for it. *Edit I should have been more clear, I didn't mean changing the size of the array. If array1 was set to 50 characters, but was only using 10 of them, you would still have 40 characters to work with. I was thinking an automatic command that would essentially do: //assuming array1 has 10 characters but was declared with 25 and array2 has 5 characters int i=10; int z=0; do{ array1[i] = array2[z]; ++i; ++z; }while(array[z] != '\0'); I am pretty sure that syntax would work, or something similar.

    Read the article

  • What is wrong with this append func in C

    - by LuckySlevin
    My Struct Definitions. typedef struct inner_list {char word[100]; inner_list*next;} inner_list; typedef struct outer_list { char word [100]; inner_list * head; outer_list * next; } outer_list; And The problem part: void append(outer_list **q,char num[100],inner_list *p) { outer_list *temp,*r; temp = *q; char *str; if(*q==NULL) { temp = (outer_list *)malloc(sizeof(outer_list)); strcpy(temp->word,num); temp->head = p; temp->next=NULL; *q=temp; } else { temp = *q; while(temp->next !=NULL) { temp=temp->next; } r = (outer_list *)malloc(sizeof(outer_list)); strcpy(r->word,num); temp->head = p; r->next=NULL; temp->next=r; } } I don't know what is i'm doing wrong in this append function i'm sending a char array and a linked list to be stored another linked list. But i can't store the linked list in another linked list. I couldn't figure out the problem. Any ideas?

    Read the article

  • Simple javascript/jquery append, remove question

    - by Scarface
    Hey guys, quick question. I have a div that on click will execute a jquery function onclick, and then replace the div with its opposite div which onclick will replace back to the first div just like the favorite function on this site. I am having a simple problem I hope someone can spot or explain to me it is not possible. The function works with the initial two divs that are served directly, but when I click on either of the original two divs, and the function executes and replaces the div with the corresponding div the replacement div does not execute the function. I have to refresh the page to get the original div, which is identical to execute the function. Is the div actually replaced on the page with append, or does it just visually show it? Any advice appreciated. original div <div class="unfavorite"><img id="unfavorite_img" src="images/favorite2.png" /></div> javascript div replacement $(".favorite").remove(); $(".favoriteholder").append('<div class="unfavorite"><img id="unfavorite_img" src="images/favorite2.png" /></div>');

    Read the article

  • mcsCustomscrollbar append new content not working

    - by Dariel Pratama
    i have this script in my website. $(document).ready(function(){ var comment = $('textarea[name=comment_text]').val(); var vid = $('input[name=video_id]').val(); $('#add_comment').on('click', function(){ $.post('<?php echo site_url('comment/addcomments'); ?>', $('#comment-form').serialize(), function(data){ data = JSON.parse(data); if(data.userdata){ var date = new Date(data.userdata.comment_create_time * 1000); var picture = data.userdata.user_image.length > 0 ? 'fileupload/'+data.userdata.user_image:'images/no_pic.gif'; var newComment = '<div class="row">\ <div class="col-md-4">\ <img src="<?php echo base_url(); ?>'+picture+'" class="profile-pic margin-top-15" />\ </div>\ <div class="col-md-8 no-pade">\ <p id="comment-user" class="margin-top-15">'+data.userdata.user_firstname+' '+data.userdata.user_lastname+'</p>\ <p id="comment-time">'+date.getTime()+'</p>\ </div>\ <div class="clearfix"></div>\ <div class="col-md-12 margin-top-15" id="comment-text">'+data.userdata.comment_text +'</div>\ <div class="col-md-12">\ <div class="hr-grey margin-top-15"></div>\ </div>\ </div>'; $('#comment-scroll').append($(newComment)); $('#comment').modal('hide'); } }); }); }); what i expect when a comment added to the DB and the PHP page give JSON response, the new comment will be added to the last line of $('#comment-scroll'). #comment-scroll is also have custom scroll bar by mcsCustomscrollbar. the above script also hiding the modal dialog when comment saved and it's working fine which is mean data.userdata is not empty, but why the append() isnt?

    Read the article

  • Append class="external" to external links.

    - by K3
    What is the php code to append class="external" to links that are posted and are not the domain. For example my site is www.mysite.com and you post a link to www.mysite.com/news and a link to www.yoursite.com How do I set it so only non "mysite.com" links have the class specified?

    Read the article

  • Java Swt Text (SWT.MULTI) append text without scroll

    - by mchr
    I have a Java SWT GUI with a multiline Text control. I want to append lines of text to the Text control without affecting the position of the cursor within the text box. In particular, the user should be able to scroll and select text at the top of the Text control while new text lines are appended to the bottom. Is this possible?

    Read the article

  • Append a large li to ul: best way?

    - by zsharp
    I have a li that has numerous nested divs. I am appending to a ul as follows: $("ul#List").append('<li><div>....many more nested divs...</li>'); the structure of the li is the same as the other lis in ul but i have to modify some elements. My question is simply am I doing it wrong by manually writing out the entire structure?

    Read the article

  • How append data to a binary file?

    - by ryudice
    I have a binary file to which I want to append a chunk of data at the end of the file, how can I achieve this using C# and .net? also are there any considerations to take when writing to the end of a binary file? thanks a lot for your help.

    Read the article

  • Can I append to a preprocessor macro?

    - by JCSalomon
    Is there any way in standard C—or with GNU extensions—to append stuff to a macro definition? E.g., given a macro defined as #define quux_list X(foo) X(bar) can I append X(bas) so that it now expands as if I’d defined it #define quux_list X(foo) X(bar) X(bas)? I’m playing with discriminated/tagged unions along these lines: struct quux_foo { int x; }; struct quux_bar { char *s; }; struct quux_bas { void *p; }; enum quux_type {quux_foo, quux_bar, quux_bas}; struct quux { enum quux_type type; union { struct quux_foo foo; struct quux_bar bar; struct quux_bas bas; } t; }; I figure this is a good place for the X-macro. If I define a macro #define quux_table X(foo) X(bar) X(bas) the enumeration & structure can be defined thus, and never get out of sync: #define X(t) quux_ ## t, enum quux_type {quux_table}; #undef X #define X(t) struct quux_ ## t t; struct quux { enum quux_type type; union {quux_table} t; }; #undef X Of course, the quux_* structures can get out of sync, so I’d like to do something like this, only legally: struct quux_foo { int x; }; #define quux_table quux_table X(foo) struct quux_bar { char *s; }; #define quux_table quux_table X(bar) struct quux_bas { void *p; }; #define quux_table quux_table X(bas) (Well, what I really want to be able to do is something like member_struct(quux, foo) { int x; }; but I’m well aware that macros cannot be (re)defined from within macros.) Anyhow, that’s my motivating example. Is there a way to accomplish this? Boost.Preprocessor examples are fine, if you can show me how to make the X-macro technique work with that library.

    Read the article

  • append files to an archive without reading/rewriting the whole archive

    - by bene
    I've got many files that I want to store in a single archive file. My first approach was to store the files in a gzipped tarball. The problem is, that I've to rewrite the whole archive if a single file is added. I could get rid of the gzip compression, but adding a file would still be expensive. What other archive format would you suggest that allows fast append operations?

    Read the article

  • Git append the current commit hash to result of a commit command

    - by farzan
    I want to append the hash of the ongoing commit to its result. I can retrieve the hash using this command: git log --format=%H | tail -1 Then I try to merge a commit with command above and make an alias in '.gitconfig', like this: [alias] ci = !git commit && git log --format=%H | tail -1 But this does not work; parameters of alias are send to tail command, not git commit. How should I create this alias?

    Read the article

  • Referring to an object's ID in a jQuery append statement

    - by Summer
    I have this element: <div class="isthisyou" id="unique_identifier"></div> I want to use jQuery to insert a link into the div: $('isthisyou').append('<a href="auth/create_account/'+this.id+'">Is this you?</a>'); Right now this.id is returning undefined instead of unique_identifier. What am I doing wrong? Thanks!

    Read the article

  • Android/Java Append String + int

    - by xger86x
    Hi, i have a question, what is the best way to append ints and Strings to build a new String? In the allocation debug tool i see too much allocations if i use the operator +. But i have tried also with StringBuffer and there are still too much allocations. Anyone can help me? Thanks

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >