• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 09:09
CEST 15:09
KST 22:09
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
TL.net Map Contest #21: Voting10[ASL20] Ro4 Preview: Descent11Team TLMC #5: Winners Announced!3[ASL20] Ro8 Preview Pt2: Holding On9Maestros of the Game: Live Finals Preview (RO4)5
Community News
Weekly Cups (Oct 13-19): Clem Goes for Four0BSL Team A vs Koreans - Sat-Sun 16:00 CET6Weekly Cups (Oct 6-12): Four star herO85.0.15 Patch Balance Hotfix (2025-10-8)80Weekly Cups (Sept 29-Oct 5): MaxPax triples up3
StarCraft 2
General
The New Patch Killed Mech! Team Liquid Map Contest #21 - Presented by Monster Energy herO joins T1 Weekly Cups (Oct 13-19): Clem Goes for Four TL.net Map Contest #21: Voting
Tourneys
INu's Battles #13 - ByuN vs Zoun Tenacious Turtle Tussle SC2's Safe House 2 - October 18 & 19 Sparkling Tuna Cup - Weekly Open Tournament $1,200 WardiTV October (Oct 21st-31st)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 496 Endless Infection Mutation # 495 Rest In Peace Mutation # 494 Unstable Environment Mutation # 493 Quick Killers
Brood War
General
BSL Season 21 BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ BW caster Sayle BSL Team A vs Koreans - Sat-Sun 16:00 CET
Tourneys
[ASL20] Semifinal B Azhi's Colosseum - Anonymous Tournament [Megathread] Daily Proleagues SC4ALL $1,500 Open Bracket LAN
Strategy
Current Meta BW - ajfirecracker Strategy & Training Relatively freeroll strategies Siegecraft - a new perspective
Other Games
General Games
Path of Exile Stormgate/Frost Giant Megathread Dawn of War IV Nintendo Switch Thread ZeroSpace Megathread
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Men's Fashion Thread Sex and weight loss
Fan Clubs
The herO Fan Club!
Media & Entertainment
Series you have seen recently... Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
Formula 1 Discussion 2024 - 2026 Football Thread MLB/Baseball 2023 NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
The Heroism of Pepe the Fro…
Peanutsc
Rocket League: Traits, Abili…
TrAiDoS
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1278 users

The Big Programming Thread - Page 615

Forum Index > General Forum
Post a Reply
Prev 1 613 614 615 616 617 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2015-04-16 23:48:32
April 16 2015 23:43 GMT
#12281
On April 17 2015 08:26 FFGenerations wrote:
STOP I FIXED IT HOLY FUCKING CHRIST


I changed the loop to say:
+ Show Spoiler +

 for (Anime anime : annj.Unmarshalling("evangelion").getAnn()) {


and removed

 annj.Unmarshalling("evangelion");


so it looks like


try{
for (Anime anime : annj.Unmarshalling("evangelion").getAnn()) {

out.println("<h1>Loop1</h1>");

out.println("<h1>ID: " + anime.getId() + "</h1>");
out.println("<h1>Name: " + anime.getName() + "</h1>");

for (Info temp : anime.getAnime()) {
if (temp.getSrc() != null) {
out.println("<h1>Info: " + temp.getSrc() + "</h1>");
}
}
}}catch(Exception e){}

out.println("<h1>End</h1>");
out.println("</body>");
out.println("</html>");


pic

+ Show Spoiler +

[image loading]


Congrats. The next lesson is not to have empty catch blocks without a good reason. Create a logger class, log the exception at the catch block.

Edit: You may also consider StringBuilder if you want. For example:


StringBuilder builder = new StringBuilder();
builder.append("string1\n");
builder.append("string2\n");
...
builder.append("more strings");

String finalString = builder.toString();

out.println(finalString);
berated-
Profile Blog Joined February 2007
United States1134 Posts
Last Edited: 2015-04-16 23:44:18
April 16 2015 23:44 GMT
#12282
On April 17 2015 08:26 FFGenerations wrote:
STOP I FIXED IT HOLY FUCKING CHRIST


I changed the loop to say:
+ Show Spoiler +

 for (Anime anime : annj.Unmarshalling("evangelion").getAnn()) {


and removed

 annj.Unmarshalling("evangelion");


so it looks like


try{
for (Anime anime : annj.Unmarshalling("evangelion").getAnn()) {

out.println("<h1>Loop1</h1>");

out.println("<h1>ID: " + anime.getId() + "</h1>");
out.println("<h1>Name: " + anime.getName() + "</h1>");

for (Info temp : anime.getAnime()) {
if (temp.getSrc() != null) {
out.println("<h1>Info: " + temp.getSrc() + "</h1>");
}
}
}}catch(Exception e){}

out.println("<h1>End</h1>");
out.println("</body>");
out.println("</html>");


pic

+ Show Spoiler +

[image loading]


I had to get netbeans, I came back to let you know that you weren't using the ann that you fetched but you obviously already figured it out -_-
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-17 02:55:17
April 16 2015 23:50 GMT
#12283
haha thanks its so hard for me to figure out this sort of thing. i usually have "some sort of idea" that "something like that" is wrong but then its just trial and error and if you dont know syntax to begin with then good luck trying to trial and error. and trial and error is the worst fucking possible thing you want to do in the first place.

going back to something like the catch is really not on the priority list since i have so much to do (3 major assignments in 6 days otherwise i fail university). so when you see me ignore something like that don't think i'm just being a dicker

thanks guys.

i would like to say that is the last major hurdle as the rest of stuff i want to do is hopefully more standard so easier to reference


i need a break but beforehand, lets think:

1) we need to add a search form and connect it to the servlet
2) return the image urls to populate the webpage with images
3) make these jquery selectable , storable attributes that can be drag-n-dropped into a stored list using jquery something
4) format the webpage to allow user to search ajaxly so that the stored list remains on one side of the webpage whilst the search results refresh on the other side (this will be annoying to figure out i guess)
5) provide a button that takes the user's stored searchresult jquery compilation list and sends it back to the servlet
6) database stuff


actually task 1 is "spend 20 minutes trying to figure out why my jsp file fails to load before realising it needs to be in a higher directory"
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-17 06:40:18
April 17 2015 04:45 GMT
#12284
+ Show Spoiler +
can anyone see what is wrong with my simple fucking ajax thing? the JSP loads with the form and i can type and submit, but nothing happens except my submission disappears from the box

i have form searchForm

i have ajax that looks at searchForm and data searchForm

i have serlvet @WebServlet(name = "SearchServlet", urlPatterns = {"/search"})

under protected void doPost i have

String searchQuery = request.getParameter("searchQuery");
returnResults(response, searchQuery);


under private void returnResults i have

response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
String resultsString = "hello";
response.getWriter().write(resultsString);


shouldnt this return "hello" to <p id="displaySearchResults"/> on my index?

the tutorial i was following takes a string and then maps it to an object , then returns the map after converting it to json using Gson. i have no fucking idea why he doesnt this and doesnt just keep it as a string.

he does something like

map <string object> map = new hashmap <string object>
map.put("searchquery", searchquery)
returnresults(response, map)

private void returnresults()
response.getwriter().write(new gson().tojson(map)


why is he doing all that instead of just response.getwriter().write(resultsstring)


index
+ Show Spoiler +


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Anime List Creator</title>

<script src="webresources/jquery-2.1.3.min.js"></script>
<script src="webresources/basic.js"></script>
<!--<link rel="stylesheet" href="webresources/css/basic.css" type="text/css" media="screen"/>-->
</head>

<body>
<h1>Anime List Creator</h1>

<form id="searchForm">
<label for="searchQuery">Make a search</label>
<input type="text" id="searchQuery" name="searchQuery"/>
<input type="submit"/>
</form>

<p id="displaySearchResults"/>
<hr/>

</body>
</html>


javascript
+ Show Spoiler +



$(document).ready(function(){
$('#searchForm').submit(function(){

$.ajax({
url: 'search',
type: 'POST',
dataType: 'text',
data: $('#searchForm'.serialize()),
success: function(data){
// if(data.isValid){
alert("hi");
$('#displaySearchResults').html("Results:" + data.resultsString);
$('#displaySearchResults').slideDown(500);
// }
// else{
// alert('Enter a valid search term.');
// }
}
});
return false;
});
});


SearchServlet
+ Show Spoiler +


/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package main;

import entities.Anime;
import entities.Ann;
import entities.Info;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
*
* @author J
*/
@WebServlet(name = "SearchServlet", urlPatterns = {"/search"})
public class SearchServlet extends HttpServlet {

@EJB
private AnnJAXB annj;

// @EJB
// private AnnJAXB annJAXB = new AnnJAXB();

@EJB
private Ann ann;

/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet SearchServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet SearchServlet at " + request.getContextPath() + "</h1>");
out.println("</body>");
out.println("</html>");
}
}

// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

// processRequest(request, response);

// Map <String, Object> map = new HashMap<String, Object>();

String searchQuery = request.getParameter("searchQuery");

// map.put("searchQuery", searchQuery);
// returnResults(response, map);

returnResults(response, searchQuery);

}

private void returnResults(HttpServletResponse response, String searchQuery) throws IOException{

response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");

String resultsString = "hello";

// try{
// for (Anime anime : annj.Unmarshalling(searchQuery).getAnn()) {
//
// resultsString = resultsString + " " + anime.getId() + " "
// + anime.getName() + " " ;
//
//
//// out.println("<h1>ID: " + anime.getId() + "</h1>");
//// out.println("<h1>Name: " + anime.getName() + "</h1>");
//
// for (Info temp : anime.getAnime()) {
// if (temp.getSrc() != null) {
// resultsString = resultsString + " " + temp.getSrc();
// }
// }
// }}catch(Exception e){}

response.getWriter().write(resultsString);

}


/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>

}



update: chrome javascript console is saying "GET http://localhost:8080/prototype11/webresources/basic.js 404 (Not Found)"

update: ok i fixed that by moving the js files to my Web Pages folder... there is no javascript error now, however nothing is still happening when i make a search

update: FIXED

had to change

data: $('#searchForm'.serialize()),


to

data: $('#searchForm').serialize(),


there is no way anyone can do this shit without asking for help and praying someone takes the time

[image loading]
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-17 21:43:42
April 17 2015 21:28 GMT
#12285
progress so far today (yes it took this long, holy shit)

i had to

1) implement a way to send my xml in json format instead of as a string. this meant trying to figure out how to map it. i ended up pursing 3 different ways of doing it (including changing my Ann class to return a toString which actually made the most sense at one point since my json string was missing a topmost idenitifer and i thought that might be a big problem (much later i see json strings without this)) but in the end there was no fucking way i could have just "figured out" the syntax to map this stuff. amazingly someone on stackoverflow gave me the syntax i needed and i just had to rearrange things a little.

2) figure out how to print my json data from the ajax to my jsp in html format. the same guy got me started but my working version ended up looking pretty different since i think he mistook my formatting (this took forever to figure out). then it still wasn't working until i read that jquery needs me to JSON.parse(data) which puts the JSON string into a JSON object before i can fucking work with it.

3) finally start looking at how to use jquery to print something in html and also iterate this. i tried to createelement but it was saying my element id was invalid , even when i tried replacing the element id etc. eventually i ended up reading that there was a jquery syntax instead of a javascript syntax and when i tried that it worked $("body").append("<img src="+mapData.url+" alt="+mapData.name+" style='width:164px;height:200px'>");


[image loading]


next i look at jquery lists (user interface) and storage (letting the user temp store which ones he added to a list)
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
April 17 2015 21:33 GMT
#12286
loool nice, it's about time :p
There is no one like you in the universe.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-18 02:47:05
April 18 2015 02:43 GMT
#12287
css update + working interface . FML CSS

[image loading]

next is looking into storage
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
Cyx.
Profile Joined November 2010
Canada806 Posts
April 18 2015 04:36 GMT
#12288
On April 18 2015 06:28 FFGenerations wrote:
progress so far today (yes it took this long, holy shit)

i had to

1) implement a way to send my xml in json format instead of as a string. this meant trying to figure out how to map it. i ended up pursing 3 different ways of doing it (including changing my Ann class to return a toString which actually made the most sense at one point since my json string was missing a topmost idenitifer and i thought that might be a big problem (much later i see json strings without this)) but in the end there was no fucking way i could have just "figured out" the syntax to map this stuff. amazingly someone on stackoverflow gave me the syntax i needed and i just had to rearrange things a little.

2) figure out how to print my json data from the ajax to my jsp in html format. the same guy got me started but my working version ended up looking pretty different since i think he mistook my formatting (this took forever to figure out). then it still wasn't working until i read that jquery needs me to JSON.parse(data) which puts the JSON string into a JSON object before i can fucking work with it.

3) finally start looking at how to use jquery to print something in html and also iterate this. i tried to createelement but it was saying my element id was invalid , even when i tried replacing the element id etc. eventually i ended up reading that there was a jquery syntax instead of a javascript syntax and when i tried that it worked $("body").append("<img src="+mapData.url+" alt="+mapData.name+" style='width:164px;height:200px'>");

haha that's starting to sound like programming now, nice work
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-18 05:21:01
April 18 2015 05:20 GMT
#12289
i think i just spent literally 3 hours trying to figure out this syntax:

$('img.selectedItemImg').each(function() {


eventually i had to ask stackoverflow for the answer.
i was using a reference that had me with:


$('.userList .selectedItemId .selectedItemImg img').each(function() {


when the working version ended up being:

$('.userList .selectedItemId .selectedItemImg').each(function() {


the example i was looking at had that "img" at the end same as mine so there was no way in hell i could have figured differently :/
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
phar
Profile Joined August 2011
United States1080 Posts
April 18 2015 05:24 GMT
#12290
On April 18 2015 11:43 FFGenerations wrote:
css update + working interface . FML CSS


https://i.imgur.com/Q3cUg29.gif

Don't feel bad.
Who after all is today speaking about the destruction of the Armenians?
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
April 18 2015 05:32 GMT
#12291
iunno, I like CSS

but that's probably because the projects i aren't complicated 10 year old messes :p
There is no one like you in the universe.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-18 05:40:03
April 18 2015 05:39 GMT
#12292
On April 18 2015 14:24 phar wrote:
Show nested quote +
On April 18 2015 11:43 FFGenerations wrote:
css update + working interface . FML CSS


https://i.imgur.com/Q3cUg29.gif

Don't feel bad.


LOL . i havent seen that episode

my working syntax is actually

$('#sortable2 .selectedItemImg').each(function() {

mfw i realise it wasnt working properly after thanking the people who helped me with such joy
(but very ez fix thank god)
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
April 18 2015 07:07 GMT
#12293
Are you using any browser dev tools? Those make your life like a thousand times easier when it comes to troubleshooting CSS and Javascript.
Average means I'm better than half of you.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-18 09:36:32
April 18 2015 07:30 GMT
#12294
LOL WHAT IS THIS MADNESS
i cant believe this fucking worked
[image loading]

On April 18 2015 16:07 WolfintheSheep wrote:
Are you using any browser dev tools? Those make your life like a thousand times easier when it comes to troubleshooting CSS and Javascript.


yeah i wasn't at first then someone on stackoverflowed reminded me about it , then also said to switch to the network tab if nothing comes up on console (dont know if that helps). but yeah i wasnt using it at first and was just raging about there being no error checking for javascript

math problem:
+ Show Spoiler +

I have a grid that is filled with X boxes. 4 boxes can fit horizontally along the grid. For every multiple of 4 boxes +1, the grid needs to expand vertically to fit a new row of boxes in.

Each box is 300 units deep/in height.

So say I have 4 boxes, the grid needs to be 300 units deep.

If I have 5 boxes it needs to be 600 units deep.

If I have 8 boxes it needs to be 600 units deep.

If I have 9 boxes it needs to be 900 units deep.

If I have 14 boxes it needs to be 1200 units deep.

The closest I am at the moment is:

height of grid = numberofentries rounded up to the nearest 4, divided by 4, times 300px

but really i have no fucking clue

nm im a moron
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
netherh
Profile Blog Joined November 2011
United Kingdom333 Posts
April 18 2015 09:41 GMT
#12295
On April 18 2015 16:30 FFGenerations wrote:
math problem:

I have a grid that is filled with X boxes. 4 boxes can fit horizontally along the grid. For every multiple of 4 boxes +1, the grid needs to expand vertically to fit a new row of boxes in.

...

height of grid = numberofentries rounded up to the nearest 4, divided by 4, times 300px


Not tested, but I think any of these would work:

int rowSize = 4;

int rows = (X / rowSize) + (X % rowSize == 0 ? 0 : 1);
int rows = ((X + rowSize - 1) / rowSize);
int rows = ceil(X / (float)rowSize); // which is basically what you mentioned.

int height = rows * 300;
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-18 09:59:20
April 18 2015 09:58 GMT
#12296
its ok dude thankyou
i basically fucked myself for hours by using wrong size images , i thought they were 300 coz i had stretched them in the html

[image loading]
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-18 13:19:37
April 18 2015 12:53 GMT
#12297
can someone tell me what the goddamn rule is for formatting ajax? i am sick and fucking tired of sitting here trying to add commas and } and ) all over the goddamn place without having any clue


$(document).ready(function () {
$('#button').click(function () {

$.ajax({
url: 'generate',
type: 'POST',
dataType: 'text',
data: $('#sortable2 .selectedItemImg').each(function (index, value) {
alert(index + " " + value);

// success: function (response) {

// send url to user
//
//
}
),
}),
},),
}

);


i dont care about the code i just need to know WHY there are random commas and } and ) that never add up. theres supposed to be a fucking "return false in there somewhere"

edit3: i fixed the code . by removing the comma. and putting in the return false. i cant figure out when ; is needed though, there is no logic to it


$(document).ready(function () {
$('#button').click(function () {

$.ajax({
url: 'generate',
type: 'POST',
dataType: 'text',
data: $('#sortable2 .selectedItemImg').each(function (index, value) {
alert(index + " " + value);

// success: function (response) {

// send url to user
//
//
}
)
});
return false;
}

);
});



oh look i remembered to add my new js file to the script header ...eventually

it looks like commas might only be needed after the ajax parameters or whatever like "datatype", "url"
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
Manit0u
Profile Blog Joined August 2004
Poland17386 Posts
Last Edited: 2015-04-18 13:31:39
April 18 2015 13:22 GMT
#12298
Do I spy some interesting titles with my porn eye among those you posted FFG?

On April 18 2015 21:53 FFGenerations wrote:
can someone tell me what the goddamn rule is for formatting ajax? i am sick and fucking tired of sitting here trying to add commas and } and ) all over the goddamn place without having any clue


$(document).ready(function () {
$('#button').click(function () {
$.ajax({
url: 'generate',
type: 'POST',
dataType: 'text',
data: $('#sortable2 .selectedItemImg').each(function (index, value) {
alert(index + " " + value);
})
});

return false;
});
});



It helps if you format the code correctly...

Also, in theory, you can omit any and all semicolons in JS, but I hate people who do with passion.
Time is precious. Waste it wisely.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-18 13:30:37
April 18 2015 13:30 GMT
#12299
lol wot that is itano tomomi she is as pure as the winds


thankyou i did say i'd fixed it. mine looks like this lol+ Show Spoiler +



$(document).ready(function () {
$('#button').click(function () {

$.ajax({
url: 'generate',
type: 'POST',
dataType: 'text',
data: $('#sortable2 .selectedItemImg').each(function (index, value) {

alert("test22");
}),
success: function (data) {
alert("test44");
}

// send url to user
//
//
}
);
});
return false;
}

);


Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
Manit0u
Profile Blog Joined August 2004
Poland17386 Posts
Last Edited: 2015-04-18 13:35:16
April 18 2015 13:33 GMT
#12300
Were I you, I'd reformat it so that you can clearly see each method's scope (where it begins and where it ends). Most IDE's should be able to do that for you with just a couple keystrokes (ctrl+alt+L in Intellij, ctl+alt(or shift)+J in Eclipse etc.).

And I wasn't talking about Tomomi (although she does seem naughty), but rather those Dark Dog Gymnastics or whatever it was called in this super hardcore hentai thingie I totally didn't see.
Time is precious. Waste it wisely.
Prev 1 613 614 615 616 617 1032 Next
Please log in or register to reply.
Live Events Refresh
INu's Battles
11:00
INu's Battle #13
ByuN vs ZounLIVE!
IntoTheiNu 77
LiquipediaDiscussion
Replay Cast
10:00
LiuLi Cup #46 - Day 1
CranKy Ducklings240
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Harstem 503
sas.Sziky 9
StarCraft: Brood War
Britney 33936
Calm 11750
Hyuk 5297
Horang2 2799
Bisu 2665
GuemChi 1540
Flash 1435
Jaedong 1218
Larva 564
Soma 500
[ Show more ]
EffOrt 387
actioN 381
Mong 310
Light 288
Soulkey 272
Mini 253
Hyun 202
Snow 189
hero 151
Pusan 121
TY 104
JYJ84
Barracks 80
ggaemo 74
Killer 73
Mind 65
Sea.KH 61
JulyZerg 59
Aegong 50
Rush 38
Noble 35
ToSsGirL 28
Movie 27
sorry 26
Sharp 20
soO 19
scan(afreeca) 19
Sacsri 16
yabsab 16
Bale 13
SilentControl 11
Terrorterran 8
Shine 8
HiyA 7
Dota 2
Gorgc4990
qojqva2590
Dendi1040
XaKoH 505
420jenkins285
XcaliburYe217
Counter-Strike
olofmeister2883
x6flipin438
Heroes of the Storm
Khaldor206
Other Games
summit1g12066
singsing2411
B2W.Neo703
hiko613
Lowko296
Sick283
Pyrionflax251
Hui .125
Happy110
oskar71
Mew2King47
ToD25
Organizations
StarCraft: Brood War
lovetv 14
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• StrangeGG 4
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• HerbMon 25
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Nemesis7636
Other Games
• WagamamaTV311
Upcoming Events
Monday Night Weeklies
2h 51m
Replay Cast
9h 51m
WardiTV Invitational
21h 51m
WardiTV Invitational
1d 1h
PiGosaur Monday
1d 10h
Replay Cast
1d 20h
Tenacious Turtle Tussle
2 days
The PondCast
2 days
OSC
2 days
WardiTV Invitational
3 days
[ Show More ]
Online Event
4 days
RSL Revival
4 days
RSL Revival
4 days
WardiTV Invitational
4 days
Afreeca Starleague
5 days
Snow vs Soma
Sparkling Tuna Cup
5 days
WardiTV Invitational
5 days
CrankTV Team League
5 days
RSL Revival
6 days
Wardi Open
6 days
CrankTV Team League
6 days
Liquipedia Results

Completed

Acropolis #4 - TS2
WardiTV TLMC #15
HCC Europe

Ongoing

BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
C-Race Season 1
IPSL Winter 2025-26
EC S1
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual

Upcoming

SC4ALL: Brood War
BSL Season 21
BSL 21 Team A
BSL 21 Non-Korean Championship
RSL Offline Finals
RSL Revival: Season 3
Stellar Fest
SC4ALL: StarCraft II
CranK Gathers Season 2: SC II Pro Teams
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.